I have two columns of data. The first column contains categories in the form of numbers, and the second column contains data that I want to sum up. So if you see the attached picture, I'd like to sum up all the red, green and blue into a single row, because each group shares the same numbered neighbor in the left column.
I tried using SUMIF but that doesn't seem to be designed for this.
You are definitely barking up the right tree with SUMIF.
Where: =SUMIF(VALUES for condition, Condition, NUMBERS to Sum)
Take a look at the attached example I put together which I believe is what you are after:
Remember to lock the appropriate cells, in my case the VALUES for condition and NUMBERS to sum so that I can drag the formula which updates the Condition cell.
You could use column C to calculate a cumulative sum, and reset whenever the value in column A changes. So, you would:
=B1
=IF(A1=A2, C1+B2, B2)
Now you can apply conditional formatting on column C to highlight the final sum when the next cell in column A is different, or you could make column D where:
=IF(A1=A2, "", C1)
This gives just the final sums, and empty cells for everything else. You can hide column C, since it's an intermediate result.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.