Excel 2003 Subract current value from value on most previous date

rrrexcel

New Member
Joined
Sep 3, 2009
Messages
10
Please help me find the best way, in Excel 2003, to calculate the difference between the values on the last two most recent occurrences of data.

Here is a sample of the data. For example: I am looking for a formula to find the difference between Ann's End Bal on 4-Oct, and Ann's End Bal on 1-Oct and give me $15. And I need that formula to also find the difference between Ann's End Bal on 9-Oct, and Ann's End Bal on 4-Oct and give me $1.

ABCD
1DescDateEnd BalDesired Result
2Ann1-Oct$10.00
3Paul2-Oct$20.00
4Greg3-Oct$30.00
5Ann4-Oct$25.00$15.00
6Paul5-Oct$36.00$16.00
7Greg6-Oct$47.00$17.00
8Paul7-Oct$38.00$2.00
9Greg8-Oct$50.00$3.00
10Ann9-Oct$26.00$1.00

<tbody>
</tbody>

Any guidance you can provide is appreciated.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
rrrexcel,

If you are ok to utilise a 'helper' column then maybe....

Helper column here is F but can be any column of your choosing and can of course be hidden.
Range of date currently max of 10000 rows - adjust if necessary.


Excel 2007
ABCDEF
1DescDateEnd BalDesired ResultHelper
2Ann01-Oct£ 10.00 Ann1
3Paul02-Oct£ 20.00Paul1
4Greg03-Oct£ 30.00Greg1
5Ann04-Oct£ 25.00£ 15.00Ann2
6Paul05-Oct£ 36.00£ 16.00Paul2
7Greg06-Oct£ 47.00£ 17.00Greg2
8Paul07-Oct£ 38.00£ 2.00Paul3
9Greg08-Oct£ 50.00£ 3.00Greg3
10Ann09-Oct£ 26.00£ 1.00Ann3
11Ann10-Oct£ 34.00£ 8.00Ann4
120
Sheet7
Cell Formulas
RangeFormula
D2=IF(ISNA(C2-INDEX(C$1:C$10000,MATCH(A2&COUNTIF(A$2:A2,A2)-1,F$1:F$10000,0),1)),"",C2-INDEX(C$1:C$10000,MATCH(A2&COUNTIF(A$2:A2,A2)-1,F$1:F$10000,0),1))
F2=A2&COUNTIF(A$2:A2,A2)


Hope that helps.
 
Last edited:
Upvote 0
Thank you, Snakehips. Your solution appears to work perfectly (in Excel 2010). I will study your formulas and try to apply it to my old spreadsheet (Excel 2003). I am grateful for your response and clear speech.
 
Upvote 0
I am writing to say, "Thank you", again to Snakehips. The formulas worked perfectly on my old computer, and I learned a lot about using the countif with the index match. Great Solution.
 
Upvote 0
Without an additional range,,,

D2, copied down:

=IF(ISNUMBER(MATCH(A2,$A$1:A1,0)),C2-LOOKUP(9.99999999999999E+307,1/($A$1:A1=A2),$C$1:C1),"")
 
Upvote 0

Forum statistics

Threads
1,216,177
Messages
6,129,323
Members
449,501
Latest member
Amriddin

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