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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

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