Avatar of Bill Golden
Bill Golden
Flag for United States of America asked on

Getting #VALUE Result in a Simple Excel Formula

I know what is wrong. I just do not know how to fix it.
B2, contains a number
C2, contains a number
D2, subtracts, B2-C2 and puts the result in D2, IF B2>0 and C2>0, otherwise D2 contains " "
F2, contains a number
G2, contains a number
H2, subtracts, F2-G2 and puts the result in H2, IF F2>0 and G2>0, otherwise H2 contains " "
At this point, everything works fine!
J2 subtracts D2-H2, IF D2>0 and H2>0, otherwise should put " " in H2
THAT WORKS, AS LONG AS D2 AND H2 CONTAIN A NUMBER, BUT
If B2 or C2 or F2 or G2 does not contain a number, J2 Returns #VALUE
Obviously I need to store something besides " " in F2 and H2 when B2 or C2 or F2 or G2 is blank.
Sample file attached.
EE-IFAND-SAMPLE.xlsx
Microsoft Excel

Avatar of undefined
Last Comment
Saqib Husain

8/22/2022 - Mon
Bill Golden

ASKER
Never mind! I stumbled across the solution building a sample spreadsheet to upload.

Is this when you feel really smart ?  ...or really dumb when you realize the solution?
Bill Golden

ASKER
I am uploading "working" sample and leaving the question open so someone can tell me how to accomplish the solution with conditional formatting.  What I was looking for to start with was to avoid getting a - in the field, H2 and H3 in the accompanying sample.
EE-IFAND-SAMPLE.xlsx
Saqib Husain

To remove the hyphen

select the cells
press Ctrl-1
Select the Number tab
From Category select Custom
In the Type box get rid of the hyphen
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Bill Golden

ASKER
Sktneer, worked wonderfully and allows me to have or not to have $

Sorry Syed. I got the shift cells up, etc. when I entered Ctrl 1
Subodh Tiwari (Neeraj)

Glad to know that Bill!
Bill Golden

ASKER
Syed. I got the shift cells up, etc. when I entered Ctrl -1
Got it, sort of. You meant for me to enter Ctrl and the number 1, not on the keypad.
Then I got the custom format window.
Sorry, yours was a solution as well.  
I will ask the moderator to split the points.  If not, I will make it up to you!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Saqib Husain

Don't you worry, It is good you have a solution.