Hello,

I want to add up multiple columns depending on the number in a specific row.

If I want to add up just the columns with a specific number (e.g. every column with a “7” in the range D3:AE3) then everything works

But now I want to add up: Example:

all columns with the number “7” in the Range D3:AE3 (sheet “update”) and write them into column D in sheet2

then I want to use a counter, add 1 and add up all columns with the number “8”

the formula I use to do this: =SUMIFS(update!D:AE, update!D:AE, “”)

*note: I saved the formula in a text file

My thoughts about this code:

I saved the columns in an array. After that I used a “while” to loop through every column in row 3 to get the number in each cell. Inside the while I used an “If” to check if the cell contains the same number as my counter c3. If not, the counter adds 1 until cell and counter have the same number. When they have the same number (e.g. 7), I used a “for each row” with an “if” inside to add up each row until it reaches an empty row.

I also inserted two “assign” to: ~go to the next column and ~to search for the next number (8)

If I start the application the counter c3 won’t stop to add 1 even if the cell and the counter have the number 7.

Does anyone knows what’s the problem about this?

The excel sheet:

before:

after: