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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Canapone

Active Member
Joined
May 10, 2007
Messages
463
Hi,

in G2

--IF(D2,D2-A2)

Regards

----------

Hi Squidd, sorry: did not mean to overlap.
 
Last edited:

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,643
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)
 

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
1,692

ADVERTISEMENT

Hi

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

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

dave
 

Watch MrExcel Video

Forum statistics

Threads
1,129,587
Messages
5,637,271
Members
416,963
Latest member
samfuge

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
Top