Subtract cells but only if both have values

Turner93

New Member
Joined
Jun 23, 2012
Messages
3
I am writing a workbook and need to subtract one cell from another but only if both cells have values entered. I'm sure this is simple but I can't figure it out. Thanks in advance for your help.


John
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
This is driving my crazy!

I want to subtract A1 from B1 only if there is a value displayed in both cells (note there is a formula in both cells). If there is not a value displayed in both A1 and B1 then I want the display in C1 to be blank. I keep getting a display of 0 in C1 and its messing up my average.

I've tried sumif with isblank but i think isblank doesn't work in this case because although the display looks blank there is a formula in both.

HELP ME! Thanks!
 
Upvote 0
This is driving my crazy!

I want to subtract A1 from B1 only if there is a value displayed in both cells (note there is a formula in both cells). If there is not a value displayed in both A1 and B1 then I want the display in C1 to be blank. I keep getting a display of 0 in C1 and its messing up my average.

I've tried sumif with isblank but i think isblank doesn't work in this case because although the display looks blank there is a formula in both.
Maybe this...

=IF(A1*B1,A1-B1,"")
 
Upvote 0
I got this to work, it assumes your formula in the cells in columns A & B return a blank.

IF(AND(A1<>"",B1<>""),A1-B1,"")
 
Upvote 0
I think you mean you want to subtract B1 from A1 :)

I think the function you are looking for is COUNTBLANK.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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