For each value in column in excel

Hi I need to loop through a column based on a value in a column. So the same product number can be in this column on multiple rows so for each product number in the row then for each order type do something. See attached workbook. So i don’t just want to go through each row, I want to go through each product number then if it is online order do something, then if it is call order do something else, then if it is magazine order do something else.Orders.xlsx (8.7 KB)

Read the excel and store in data table. Then use for each row to loop through each row. You will get the product number as row(“Product number”).tostring and the Order type as row(“Order Type”).tostring. use these in IF condition and check if it online or call, then do the steps in THEN or ELSE in IF condition. Hope I’m clear :slight_smile:

Yeah but that would be a lot of IFs for hundreds of product numbers right? I don’t want to create an if for each product number

You are looping through the data table and it will loop for each and every product number and check the order type in that one IF condition and do the necessary in the THEN or ELSE. That’s it. You don’t need to use number of activities for the number of rows. One will loop through all the rows

Got the idea of it. Do you mind posting a sample workflow so I can see what you mean?

@gregelliott it sounds like you want to group all product IDs by order type and sum the amounts, correct? so from your example, the output would be

Product ID | Order Type | Amount
1111111    | Online     | 2050
1111111    | Call       | 2300
1111112    | Online     | 400
1111111    | Call       | 825

Is that correct? Then you’d iterate through that new output table to do further processing on each invidividual product id/order type combo?

yeah basically

PFA sample XAML showcasing on how to sum the Amounts for Product ID, OrderTypegregelliott.xaml (9.2 KB)

Please modify the filepath to EXCEL accordingly.

Let us know your feedback. Thanks

Is there a way to use a for each row? based on that product ID column? Also I actually wont be summing. I will be appending the values from these columns and pasting into a table in a word document.

So in this case, based on product ID 1111111 I will be taking the first three rows and inputting into one word document table for the fields OrderType, CustomerName, CustomerEmail, DateOrdered, Amount. Then open a new word doc with a table for product ID 1111112 and do the same.
Orders.xlsx (9.8 KB)

shifting to a for each row and doing the the task or aggretation is technically possible. just use the for each row activity. In case of you need further help then please let us know the requirement best along with coupled sample data for e.g. input expected output.

sample input and output are in this (17.2 KB)

Can you help me get there with a for each perhaps?