# Conditionally Minus Result

#### Stephen_IV

##### Well-known Member
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
Is this not as simple as typing =B5-A5 in cell B6 and then copying this across row 6?

##### MrExcel MVP
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))

#### Andrew Poulsom

##### MrExcel MVP
Similarly:

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

#### Stephen_IV

##### Well-known Member

Thank you so much. Worked perfectly!

#### Andrew Poulsom

##### MrExcel MVP
Andrew Poulsom,

Thank you so much. Worked perfectly!

Except, of course, in month 1.

Replies
1
Views
321
Replies
42
Views
1K
Replies
7
Views
943
Replies
0
Views
770
Replies
2
Views
263

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.

### Which adblocker are you using?

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

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