Excel Worksheet Function Help - Subtract first item from last item in grouping

Hi Experts,

I have a spreadsheet that has grouped repeating numbers in column B.  There are times associated with those numbers.  I need the last number in the group minus the first number in the group to be in column M on the last row in that grouping.

Sounds confusing, but I've attached a spreadsheet to make it easier.  I know that I can do this with VBA but I would much rather use a formula.

Test.xlsm

Thanks
-Jeremy
LVL 10
FamousMortimerAsked:
Who is Participating?
 
barry houdiniConnect With a Mentor Commented:
Hello Jeremy, try this formula in M2 copied down

=IF(B2<>B3,L2-LOOKUP(2,1/(B$1:B1<>B2),L$2:L2),"")

see attached

regards, barry
26890495.xlsm
0
 
Chris Raisin(Retired Analyst/Programmer)Commented:
What version of Excel are you using?
0
 
FamousMortimerAuthor Commented:
Forgot to mention... 2010
0
 
FamousMortimerAuthor Commented:
Very nice, thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.