if no value equal 0 if change equals change amount

agoodson1956

Board Regular
Joined
Sep 1, 2016
Messages
140
I have a cell A2 with a number in it. Then I have another cell D2 with a number in it.

I want to subtract A2 from D2 and update cell G2, but if the value in D2 is blank I want G2 value to be 0

Help please
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
try this in g2
Code:
=IF(D2="","0",D2-A2)

dave
 
Upvote 0
Hi,

in G2

--IF(D2,D2-A2)

Regards

----------

Hi Squidd, sorry: did not mean to overlap.
 
Last edited:
Upvote 0
Just to note:

SQUIDD's formula will return "0" as text, not as a number.
Canapone's formula will not work if cell D2 is blank-looking (not actually empty).

The following formula addresses both issues:

=IF(D2="",,D2-A2)
 
Upvote 0
Hi

if value 0 is required you may also change my formula to

Code:
=IF(D2="",0,D2-A2)

dave
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

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