user4227915
user4227915

Reputation:

How to sum column-b values while column-a values are the same?

I've simulated my problem.. because my original plan is complex to describe:

enter image description here

I need C4 to be 8 because A2 = A3 = A4, and 5 + 2 + 1 results in 8.

Using this logic, the expected results should be:

C4:8 C6:10 C10:23 C12:23


Well, my problem:

I can't use sumif due after the last day of the month (28, 29, 30 or 31) the next day will be 1 again.

I'm stucked on that. Any help would be appreciated.

Thank you for your time.

Upvotes: 0

Views: 129

Answers (3)

Gary's Student
Gary's Student

Reputation: 96753

In C2 enter:

=IF(A2=A3,"",SUM($B$2:B2)-SUM($C$1:C1))

and copy down

enter image description here

EDIT#1:

The first part of the IF insures blanks where they are needed. The second part of the IF adds up all of column B, but removes parts of B that already appear in column C

Upvotes: 2

Blind Seer
Blind Seer

Reputation: 502

If it needs to be in the same table I'd go with:

=IF(C2<>C1,SUMIFS([Number],[Day],[@Day],[Month],[@Month]),"")

Where column C contains the days. This way only the first row will show the sums. Or you could use an extra table containing Year, Month and day and use: =SUMIFS([Number],[Day],[@Day],[Month],[@Month])

to collect your data and have it aggregated into one table for further use.

Upvotes: 3

whytheq
whytheq

Reputation: 35557

Maybe something like the following. The formula in the first cell is different than the others:

enter image description here

The numbers in between your target cells are still showing - is that a problem?

enter image description here

Upvotes: 1

Related Questions