Conditionally Minus Result

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,125
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have an issue. What I am trying to is to minus the last 2 results in a column. As you can see below. We do attendance daily. What I would like to do is minus the last to figures greater than 0. In the case below it will be =B5-A5 for the next day it will be =C5-B5 Etc. Can someone please help me with a formula. Thanks in advance Stephen.<
Book1
ABCDEFGHIJKLMNOPQR
112378910111415161718212223
2911
31011
4712
52634000000000000008
Sheet1
Book1
ABCDEFGHIJKLMNOPQR
112378910111415161718212223
291111
3101110
471214
526343500000000000001
Sheet2
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Expiry

Well-known Member
Joined
Jun 20, 2007
Messages
865
Is this not as simple as typing =B5-A5 in cell B6 and then copying this across row 6?
 
Upvote 0

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Stephen,

Channge the SUM formula in A5 to:

=IF(COUNT(A2:A4),SUM(A2:A4),"")

Define BigNum as referring to:

=9.99999999999999E+307

Then invoke for substraction:

=LOOKUP(BigNum,A5:P5)-LOOKUP(BigNum,INDEX(A5:P5,MATCH(BigNum,A5:P5)-1))
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Similarly:

=INDEX(A5:P5,1,MATCH(9.99999999999999E+307,A2:P2))-INDEX(A5:P5,1,MATCH(9.99999999999999E+307,A2:P2)-1)
 
Upvote 0

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,125
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Aladin Akyurek, Andrew Poulsom,

Thank you so much. Worked perfectly!
 
Upvote 0

Forum statistics

Threads
1,190,700
Messages
5,982,371
Members
439,776
Latest member
mathewduffy

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
Top