Subtracting scores based on dates from case numbers

Starstar1

New Member
Joined
Nov 29, 2018
Messages
4
Hello,

I need to subtract baseline score from the most recent score for a specific id. I was filtering and subtracting for each case number but there are too many entries and some have multiple dates. Please help! What is the most efficient way to do this? Formulas? I need it in the D) Results column. (I have beginner skills :/) (Using 2010 Excel on windows.)
Please see below:

A B C D
[TABLE="width: 389"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]CASE_NUM[/TD]
[TD] Date [/TD]
[TD] Average Functioning Score[/TD]
[TD] RESULT[/TD]
[/TR]
[TR]
[TD="align: right"]418557[/TD]
[TD="align: right"]5/10/2018[/TD]
[TD="align: right"]1.27[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]418557[/TD]
[TD="align: right"] 11/16/2018[/TD]
[TD="align: right"]1.27[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417870[/TD]
[TD="align: right"]5/9/2018[/TD]
[TD="align: right"]1.47[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417870[/TD]
[TD="align: right"]11/15/2018[/TD]
[TD="align: right"]1.47[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417841[/TD]
[TD="align: right"]5/4/2018[/TD]
[TD="align: right"]1.40[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417841[/TD]
[TD="align: right"]11/8/2018[/TD]
[TD="align: right"]1.40[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417131[/TD]
[TD="align: right"]4/20/2018[/TD]
[TD="align: right"]1.20[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417131[/TD]
[TD="align: right"]10/23/2018[/TD]
[TD="align: right"]1.20[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417026[/TD]
[TD="align: right"]4/26/2018[/TD]
[TD="align: right"]1.33[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]417026[/TD]
[TD="align: right"]10/30/2018[/TD]
[TD="align: right"]1.33[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]416700[/TD]
[TD="align: right"]4/18/2018[/TD]
[TD="align: right"]0.87[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]416700[/TD]
[TD="align: right"]10/18/2018[/TD]
[TD="align: right"]0.87[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]416692[/TD]
[TD="align: right"]4/9/2018[/TD]
[TD="align: right"]1.13[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]416692[/TD]
[TD="align: right"]10/8/2018[/TD]
[TD="align: right"]1.13[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]

Thank you :)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, welcome to the board.

Can you explain please, what do you want the results to be ?
Give results for several different examples please, and also please describe how you arrived at those results.
 
Upvote 0
Hi, welcome to the board.

Can you explain please, what do you want the results to be ?
Give results for several different examples please, and also please describe how you arrived at those results.


Hello Gerald, Thanks for replying.

The Results are the difference from the "Average functioning score". So I want to take the baseline "average functioning score" from the earliest date for a "case number" and subtract it from the most recent date of that "case number".

So it should be like this:

[TABLE="class: cms_table, width: 389"]
<tbody>[TR]
[TD][TABLE="width: 0"]
<tbody>[TR]
[TD]CASE_NUM
[/TD]
[TD] Date
[/TD]
[TD] Average Functioning Score
[/TD]
[TD] RESULT
[/TD]
[/TR]
[TR]
[TD]265754
[/TD]
[TD]2/6/2018[/TD]
[TD] 1.60
[/TD]
[TD]-0.47
[/TD]
[/TR]
[TR]
[TD]265754
[/TD]
[TD]3/21/2018[/TD]
[TD] 1.13
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]265754
[/TD]
[TD]10/15/2018
[/TD]
[TD] 1.13
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]265064
[/TD]
[TD]4/2/2018
[/TD]
[TD] 1.13
[/TD]
[TD]0.00
[/TD]
[/TR]
[TR]
[TD]265064
[/TD]
[TD]4/11/2018
[/TD]
[TD] 1.00
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]265064
[/TD]
[TD]10/1/2018
[/TD]
[TD] 1.13
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]263852
[/TD]
[TD]4/11/2018
[/TD]
[TD] 0.93
[/TD]
[TD]0.07
[/TD]
[/TR]
[TR]
[TD]263852
[/TD]
[TD]5/1/2018
[/TD]
[TD] 1.00
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]263852
[/TD]
[TD]5/18/2018
[/TD]
[TD] 1.40
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]263852
[/TD]
[TD]11/5/2018
[/TD]
[TD] 1.00
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

For Case number 265754 the earliest date entry is 2/6/2018, and its score is 1.60. So I want to subtract that from the latest date entry: 10/15/2018 and its score is 1.13. So it should be 1.13-1.60=-0.47. (example formula:=C3-C1)I would like to see if there is an easier way as opposed to doing it manually. I hope that makes sense. Thank you.
 
Upvote 0
OK thanks, I need to go away and think about that.

In the meantime, will the data ALWAYS be sorted in the sequence shown in post #3 ?
That could be helpful if it is.
 
Upvote 0
OK thanks, I need to go away and think about that.

In the meantime, will the data ALWAYS be sorted in the sequence shown in post #3 ?
That could be helpful if it is.

Yes, I believe so. I've sorted the Case number column so duplicates are grouped together and the dates are sorted so the earliest shows up first for corresponding case numbers. Ok, don't go away too far plz :D
Thanks for your help.
 
Upvote 0
@Starstar1
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Hello,


My apologies for the double post I was super stumped and also wasn't aware that posting somewhere else can be an issue. But this is the formula that worked for me:


=IF(AGGREGATE(15,6,$B$2:$B$11/($A$2:$A$11=A2),1)=B2,INDEX($C$2:$C$11,MATCH(AGGREGATE(14,6,$B$2:$B$11/($A$2:$A$11=A2),1),INDEX($B$2:$B$11/($A$2:$A$11=A2),),))-C2,"")




-Thanks
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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