What change can I make to this formula to produce the desired output?

I would like to make a change to this formula in Excel.

=F297+D298-E298

If the field in D and E are both blank - then the output be blank.
Only if either field D or E are populated, then the output should reflect the initial amount in F297 plus any changes.

How can this be changed?
100questionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ProfessorJimJamCommented:
=if(or(d298<>"",e298<>""),sum(F297+D298-E298),"")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gerwin Jansen, EE MVETopic Advisor Commented:
What if both D and E are populated?
0
Steven CarnahanNetwork ManagerCommented:
Use AND instead of OR

=if(or(d298<>"",e298<>""),sum(F297+D298-E298),"")

should be

=if(AND(d298<>"",e298<>""),sum(F297+D298-E298),"")

Only I think what I have is:

=IF((AND(D298<1, E298<1)),0,F297+D298+E298)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

100questionsAuthor Commented:
if D and E are populated - or whether D alone is populated or E alone is populated - then the output must be visible
0
Steven CarnahanNetwork ManagerCommented:
The formula I provided will only do the calculation if both D and E are not less than 1. It will not do the calculation if D and E is a negative number or any part of a number below 1 (0.8 for instance)
0
100questionsAuthor Commented:
I see.  The formula should be adjusted if any amount if populated in either D or E or both, even negative amounts.
Is this possible?
0
Steven CarnahanNetwork ManagerCommented:
Do you want it anything but "0"?

=IF((AND(D298<>0, E298<>0)),F297+D298+E298,0)

This will place a "0" only if either D298 or E298 is "0" or blank, otherwise will perform the calculation
0
Steven CarnahanNetwork ManagerCommented:
Wait,  working on an error.  This formula will do the calculation as long as there is a value not equal to "0" in both but not if there is a value in either.  

I think we are back to the OR instead of the AND.

=IF((OR(D298<>0, E298<>0)),F297+D298-E298,0)    (noticed I have been using a "+" instead of "-" in the last part of the calculation)

or again what Professorjimjam originally posted:

=if(or(d298<>"",e298<>""),sum(F297+D298-E298),"")

The second will nothing in the field where mine puts a "0"
0
100questionsAuthor Commented:
Thanks.  Nothing in the field ia the desired output if D and E have nothing in their fields simultaneously.
0
Steven CarnahanNetwork ManagerCommented:
Then I suggest you go with the first solution provided by Professorflimflam.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.