# Question on Iterate Column

**URL:** <https://community.easymorph.com/t/question-on-iterate-column/2459>\
**Category:** General Q&A\
**Created:** [February 11, 2021, 2:50pm UTC](https://community.easymorph.com/t/question-on-iterate-column/2459 "2021-02-11T14:50:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmainsworth](https://community.easymorph.com/letter_avatar_proxy/v4/letter/k/2acd7d/32.png) [@kmainsworth](https://community.easymorph.com/u/kmainsworth)\
**Post date:** [February 11, 2021, 2:50pm UTC](https://community.easymorph.com/t/question-on-iterate-column/2459/1 "2021-02-11T14:50:39Z")

</div>

I understand how to use iterate column when specifying a column name, I want to do something just a little bit different. I want to apply the same formula to a set of columns using a value in another column in the same row.

Example

Table has 5 columns - Model#, Price1,Price2,Price3,Std\_Disc\_Pct

I want to replace value in each of the "PriceX" columns using the formula (PriceX value \* Std\_Disc\_Pct value for that row). My issue is that my table has 158 "PriceX" columns and I don't want to have to create an indiviual calculation for each "PriceX" column, I just want to loop through the columns and apply the formula. The "Std\_Disc\_Pct" will be different for each row so I need to "row" process the dataset.

Any help would be greatly appreciated.

Thanks,

Keith

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [February 11, 2021, 5:03pm UTC](https://community.easymorph.com/t/question-on-iterate-column/2459/2 "2021-02-11T17:03:49Z")

</div>

I would unpivot all the PriceX columns, did the multiplication, and then pivoted them back.

See the example below.

[multiply columns.morph](https://community.easymorph.com/uploads/short-url/bH8Uf401Q9a6mQvwRKKBsLddM34.morph) (2.5 KB)  
[data.txt](https://community.easymorph.com/uploads/short-url/gorrTFamdz55YbAebopIzc4rwS1.txt) (63 Bytes)

 ![image](https://community.easymorph.com/uploads/default/original/2X/0/03fc7dc8df1da0e14359d0e311fde99b9e1c824d.png)

If the table is too big to unpivot the entire table at once, you can unpivot it line by line using the technique described in my earlier answer here:

> [@Need some iteration assistance - Iterate Table](https://community.easymorph.com/t/need-some-iteration-assistance-iterate-table/2455/2):
>
> Thank you for the detailed description, Keith. There are two ways how to iterate a table and have the row data in the iterated module: Use the "Parameter table" action If the table isn't too wide, then you can assign all its columns to the respective parameters of the iterated module. In the iterated module, use the "Parameter table" action to create a 1-row table with parameter values as columns. Iterating table with itself Alternatively, derive a table and use the "Iterate table" action to…
