Google-sheets – How to find the sum of a specific row of values, but only for columns that contain a different specific value

formulasgoogle sheetsgoogle-sheets-arrayformula

My sheet looks something like this:
enter image description here

I'm trying to create a formula for the Total profit column, which would be the sum of the winnings/losses for that person for that row. So for instance, for Person1, the value would be -41.15, (i.e. –70 + 13.05 +15.8).

My approach was something like this: Get the columns that have at least one cell that has the exact value "Winnings/Losses". From those columns, sum over the values from the row that corresponds to the current person.

I've been trying to use formulas like FILTER, ARRAYFORMULA, VLOOKUP, etc, to no avail, I just can't seem to get them to do what I want. I've found the sheet formulas to be non-intuitive. probably because I come from an imperative programming background (C, Python, Typescript, etc). Any help is appreciated.

Best Answer

You can try =sumif()

=SUMIF($B$1:$E$1,"B",B2:E2)

enter image description here


Here's a dummy sheet

You just need to replace B with Winning/Losses or whatever you need.