# Arranging column values

**URL:** <https://forum.knime.com/t/arranging-column-values/43485>\
**Category:** KNIME Analytics Platform\
**Created:** [May 25, 2022, 12:21pm UTC](https://forum.knime.com/t/arranging-column-values/43485 "2022-05-25T12:21:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 25, 2022, 12:21pm UTC](https://forum.knime.com/t/arranging-column-values/43485/1 "2022-05-25T12:21:35Z")

</div>

Hello,  
My table looks somewhat like this, and I need the result in the **Expected format**  
I have attached the table format:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/b/c/bc408d91e9e3f2a8686c31e8051f688ff9c0c9f7.png)  
Can someone please help me out with this, as in Sorter node doesn’t seem to help me in this case. What else can I be using in this scenario, to arrange the column values in user defined format?  
Any help would be appreciated, Thank you!

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 25, 2022, 12:26pm UTC](https://forum.knime.com/t/arranging-column-values/43485/2 "2022-05-25T12:26:35Z")

</div>

Hi @Saishiyam,

I believe the esiest way to sort the rows as in your final table is to use a -Join- node with a first table (as left table in joiner) created with -Table Creator-node which should contain just the column “A comment” in your right order. Then join by column “A comment” and in the column selection, keep only the columns of your second table (as right table in joiner).

Hope it helps. Otherwise, please post here your table in text format and we will take it from there.

Best  
Ael

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 25, 2022, 12:35pm UTC](https://forum.knime.com/t/arranging-column-values/43485/3 "2022-05-25T12:35:39Z")

</div>

@aworker Thank you for the suggestion, but sometimes more comments might be present, depending upon the input data. In that case, what would be the best approach to solve this?  
Here are the table values as requested:

| A comment | B comment | US Count | UK Count | Grand Total |
| --- | --- | --- | --- | --- |
| Ok - no difference | NA | 23 | 12 | 35 |
| Ok tax pop off(part of gov) | NA | 0 | 22 | 22 |
| ICT to check | Team to check | 12 | 21 | 33 |
| Grand total | | 35 | 55 | 90 |

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 25, 2022, 12:39pm UTC](https://forum.knime.com/t/arranging-column-values/43485/4 "2022-05-25T12:39:22Z")

</div>

My pleasure @Saishiyam

Sorry I find difficult to understand the logic behind what you need to do. Do you always want to have the N/A at the “B Comment” column appearing in the last rows but before your “Grand total” row ? Is that what you mean ?

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 25, 2022, 12:42pm UTC](https://forum.knime.com/t/arranging-column-values/43485/5 "2022-05-25T12:42:44Z")

</div>

@aworker  
Actually, this is a pivot created by knime. Now, I want to arrange the ‘A Comment’ column values according to requirements (Like moving the 1st comment to 3rd position and vice verse etc)  
This is the requirement. Is it possible to achieve the same?

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 25, 2022, 12:51pm UTC](https://forum.knime.com/t/arranging-column-values/43485/6 "2022-05-25T12:51:48Z")

</div>

@Saishiyam I’m still missing the logic of the sorting.

Why should 1st A comment be moved to 3rd position and vice-versa ? Thanks.

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 25, 2022, 12:56pm UTC](https://forum.knime.com/t/arranging-column-values/43485/7 "2022-05-25T12:56:05Z")

</div>

@aworker That’s the business requirement and the stakeholders want to maintain that 😅

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 25, 2022, 1:46pm UTC](https://forum.knime.com/t/arranging-column-values/43485/8 "2022-05-25T13:46:27Z")

</div>

Maybe this answers your question 🤔

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/9/493a9fad0ea3510012a675e8b1ed7deb731b9a60.png)

[20220525 Pikairos Arranging column values.knwf](https://forum.knime.com/uploads/short-url/t0DseHwIbBKabBVZsXo7oo0l0QP.knwf) (40.3 KB)

But still I’m a bit perplex lol 😅

Best  
Ael

---

<div class="post-metadata">

**Author:** ![lelloba](https://forum-cdn.knime.com/user_avatar/forum.knime.com/lelloba/32/43992_2.png) [@lelloba](https://forum.knime.com/u/lelloba)\
**Post date:** [May 25, 2022, 2:02pm UTC](https://forum.knime.com/t/arranging-column-values/43485/9 "2022-05-25T14:02:43Z")

</div>

Hi,

aworker’s solution is more solid, but if you want to change the order quickly maybe this can help:

> **[Reordering rows – lelloba](https://hub.knime.com/lelloba/spaces/Forum/latest/Reordering%20rows~FSOJUdhBPqZqKVS8)**
>
> Solutions for data science: find workflows, nodes and components, and collaborate in spaces.

RB

---

<div class="post-metadata">

**Author:** ![Daniel\_Weikert](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@Daniel\_Weikert](https://forum.knime.com/u/Daniel_Weikert)\
**Post date:** [May 25, 2022, 4:34pm UTC](https://forum.knime.com/t/arranging-column-values/43485/10 "2022-05-25T16:34:34Z")

</div>

If you transpose you can rearange the columns with Table Manipulator manually the way you want it (whatever the Logic might be).  
br

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 26, 2022, 8:29am UTC](https://forum.knime.com/t/arranging-column-values/43485/11 "2022-05-26T08:29:31Z")

</div>

Hi @Saishiyam

Did any of the solutions posted here solved your problem ? Feedback would be much appreciated 🙂

Best  
Ael

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 26, 2022, 8:50am UTC](https://forum.knime.com/t/arranging-column-values/43485/12 "2022-05-26T08:50:17Z")

</div>

Hi @aworker  
Actually I made use of rule engine and created a key column based on the order in which my comments has to appear, and then sorted it in ascending order. That actually worked for me.  
Thank you for all the suggestions!

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 26, 2022, 8:54am UTC](https://forum.knime.com/t/arranging-column-values/43485/13 "2022-05-26T08:54:10Z")

</div>

Hi @Saishiyam

Thanks for the feedback. Maybe you could post here your solution for the interest of the community 😉  
Best wishes,  
Ael

---

<div class="post-metadata">

**Author:** ![badger101](https://forum-cdn.knime.com/user_avatar/forum.knime.com/badger101/32/45755_2.png) [@badger101](https://forum.knime.com/u/badger101)\
**Post date:** [May 26, 2022, 11:25am UTC](https://forum.knime.com/t/arranging-column-values/43485/14 "2022-05-26T11:25:39Z")

</div>

Hi @Saishiyam , could you share your solution here so others can benefit as well?

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 26, 2022, 11:50am UTC](https://forum.knime.com/t/arranging-column-values/43485/15 "2022-05-26T11:50:09Z")

</div>

@aworker @badger101 here is what I tried  
[Reordering rows (1).knwf](https://forum.knime.com/uploads/short-url/kvSxT7gntizWtLyNKFtK9KX1Oyf.knwf) (10.0 KB)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/a/d/adfcc4d1ebd00de823bdb31aae69b6862be839d9.png)  
mentioned the comments in rule engine and assigned key to them and ordered them using a sorter node.

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 26, 2022, 11:54am UTC](https://forum.knime.com/t/arranging-column-values/43485/16 "2022-05-26T11:54:35Z")

</div>

It sounds to me a very wise alternative solutions.  
Thanks @Saishiyam for sharing 😀 👍

---

<div class="post-metadata">

**Author:** ![badger101](https://forum-cdn.knime.com/user_avatar/forum.knime.com/badger101/32/45755_2.png) [@badger101](https://forum.knime.com/u/badger101)\
**Post date:** [May 26, 2022, 12:00pm UTC](https://forum.knime.com/t/arranging-column-values/43485/17 "2022-05-26T12:00:53Z")

</div>

Thanks for sharing! @Saishiyam

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 26, 2022, 2:50pm UTC](https://forum.knime.com/t/arranging-column-values/43485/18 "2022-05-26T14:50:59Z")

</div>

@aworker Thank you!  
@badger101 Welcome!!  
😃

---

<div class="post-metadata">

**Author:** ![Saishiyam](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@Saishiyam](https://forum.knime.com/u/Saishiyam)\
**Post date:** [May 27, 2022, 4:16am UTC](https://forum.knime.com/t/arranging-column-values/43485/19 "2022-05-27T04:16:43Z")

</div>

Is there any possibility that I can add color to cells dynamically without manually specifying the range?  
for eg

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/3/9/399426df53d9a9bb72f8301d9427f3b0d9ff15e7.png)  
I need the grand total row to be colored, but the row which it might be present will differ depending upon the number of comments present. The continental node provides the xls range selector, but that looks more of hard coding way. Is there any other way through which I can achieve this

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [May 27, 2022, 8:53am UTC](https://forum.knime.com/t/arranging-column-values/43485/20 "2022-05-27T08:53:47Z")

</div>

Hi @Saishiyam

I have posted at the KNIME HUB a generic example on how to dynamically format an Excel Sheet using the Continental nodes:

> **[20220527 Pikairos How to automatically Customize Excel Sheet Format and Colors...](https://hub.knime.com/pikairos/spaces/Public/latest/20220527%20Pikairos%20How%20to%20Dynamically%20Format%20and%20Color%20an%20Excel%20Sheet~8VEGmWpbo_5rW_pL)**
>
> This workflow shows how to format an Excel Sheet dynamically using the Continental Plugin. The example shows how to configure the Excel font type, color and si…

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/7/e7c87405ae014117ca6b5e547366b076dc1584c7.png)

This example is not doing what you exactly need. You would need from there to customize this component to your needs but the example already covers how to do it for most of the formatting features one would normally need.

Hope it helps.

Best,

Ael

[Next page](https://forum.knime.com/t/arranging-column-values/43485.md?page=2)
