IF Problem

martyloo

Board Regular
Joined
Sep 29, 2010
Messages
100
Hi I have two columns A, B
A1 = 4
A2 =
A3 = 3
A4 =
A5 =
A6 = 7
A7 =

B1 =
B2 = 6
B3 =
B4 =
B5 = 4
B6 =
B7 = 9

I want to do a calculation in C1 - C7 that if B7 has a value then minus this value from the next cell in column A which has a value

So in this case, B7 - A6 = 2
B5 - A3 = 1
B2 - A1 =2

Can anyone help with a forumla I can put in C1 and just copy it down to calculate these values?

Thanks in advance

Marty
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What is the maximum number of levels (rows) that you might need to check (in your example, it was three, from row 5 to row 3, but realsitically, how far might you need to go)?
Also, are you only doing calculations in column C where there are matching values in column B (so no calculations in C6, C4, C3, etc)?
 
Upvote 0
How about
=IF(B1="","",B1-LOOKUP(2,1/(A$1:A1<>""),A$1:A1))
 
Upvote 0
So there are around 7,000 rows I just need the first value in column B to minus the next value in column A
Then the next value after this in column B to minus the next value in column A so on so forth.
 
Upvote 0

Forum statistics

Threads
1,215,009
Messages
6,122,674
Members
449,091
Latest member
peppernaut

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