Sum Based on the Last Entries of Each Series

Orion19

Board Regular
Joined
Dec 18, 2017
Messages
56
Hello!!

Here's a raw data sample:

DateProgramPhase
1/1/18
Circle
PRM
1/2/18CircleP2
1/3/18CircleP3
1/1/18SquarePRM
1/2/18SquareP1MT
1/3/18SquareP2
1/1/18TriangleP3

<tbody>
</tbody>

I'd like Excel to find the last entry for a given Program (Column B) then count which Phase it is in (Column C). The ideal output for this would be as follows:

PhaseCount
P21
P32

<tbody>
</tbody>

The last Phase for "Circle" was "P3", the last Phase for "Square" was "P2", and the last Phase for Triangle was "P3". So, "P2" received a sum of "1" while "P3" received a sum of "2". Does anyone have any ideas on how to approach that? I need to ignore all Phase entries except those that are the very last for a given program. Thank you so much in advance!!!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I hope this is what you're looking for.

ABCDE
1DateProgramPhase
21/01/18CirclePRM
31/02/18CircleP2
41/03/18CircleP3
51/01/18SquarePRM
61/02/18SquareP1MT
71/03/18SquareP2
81/01/18TriangleP3
9
10
11max DateRowPhase of max Date
12Circle1/03/183P3
13Square1/03/186P2
14Triangle1/01/187P3
15
16PhasesCount
17PRM0
18P21
19P32
20P1MT0

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet22
 
Upvote 0
Yes, exactly! The section on the bottom is the end result I'm looking for. What formulas would I need to get there? For example, how could you find the max date for Circle?


I hope this is what you're looking for.

ABCDE
1DateProgramPhase
21/01/18CirclePRM
31/02/18CircleP2
41/03/18CircleP3
51/01/18SquarePRM
61/02/18SquareP1MT
71/03/18SquareP2
81/01/18TriangleP3
9
10
11max DateRowPhase of max Date
12Circle1/03/183P3
13Square1/03/186P2
14Triangle1/01/187P3
15
16PhasesCount
17PRM0
18P21
19P32
20P1MT0

<tbody>
</tbody>
Sheet22
 
Last edited:
Upvote 0
For some reason, the formulas did not post. here we go:

ABCDE
1DateProgramPhase
21/01/18CirclePRM
31/02/18CircleP2
41/03/18CircleP3
51/01/18SquarePRM
61/02/18SquareP1MT
71/03/18SquareP2
81/01/18TriangleP3
9
10
11max DateRowPhase of max Date
12Circle1/03/183P3
13Square1/03/186P2
14Triangle1/01/187P3
15
16PhasesCount
17PRM0
18P21
19P32
20P1MT0

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet22

Worksheet Formulas
CellFormula
C12=MAXIFS($A$2:$A$8,$B$2:$B$8,B12)
C13=MAXIFS($A$2:$A$8,$B$2:$B$8,B13)
C14=MAXIFS($A$2:$A$8,$B$2:$B$8,B14)
E12=INDEX($C$2:$C$8,D12)
E13=INDEX($C$2:$C$8,D13)
E14=INDEX($C$2:$C$8,D14)
C17=COUNTIFS($E$12:$E$14,B17)
C18=COUNTIFS($E$12:$E$14,B18)
C19=COUNTIFS($E$12:$E$14,B19)
C20=COUNTIFS($E$12:$E$14,B20)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D12{=MAX(IF(MAX(IF($B$2:$B$8=B12,$A$2:$A$8))=(($B$2:$B$8=B12)*$A$2:$A$8),ROW($C$2:$C$8)-ROW($C$1)))}
D13{=MAX(IF(MAX(IF($B$2:$B$8=B13,$A$2:$A$8))=(($B$2:$B$8=B13)*$A$2:$A$8),ROW($C$2:$C$8)-ROW($C$1)))}
D14{=MAX(IF(MAX(IF($B$2:$B$8=B14,$A$2:$A$8))=(($B$2:$B$8=B14)*$A$2:$A$8),ROW($C$2:$C$8)-ROW($C$1)))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try to enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,954
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top