# Calculating with blanks in excel

I wanted to calculate total savings and percentages with blanks, for example if column B is blank then I the calculation should be blank as well in column C, this applies to column D for percentage difference as well..  See attachment.
###### Who is Participating?

x
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.

Director of Information TechnologyCommented:
Is this what you are looking for?

Here is the excel file.

ConsultantCommented:
Hi LUIS,

Does that do what you want?

I have entered a calculation in the percentage column, but you might be defining that percentage differently, so please check before using.

Thanks,

Alan.
EE-29089427-C--Users-lfreund-Downlo.xlsx
Director of Information TechnologyCommented:
I made a mistake in my formula

should have been after seeing Alan's xlsx file
``````=iferror(c2/a2,0)
``````

Either one (Iferror or If) of the function get you the desired results.
Excel & VBA ExpertCommented:
Hi Luis,

Maybe you need...

In C2
``````=IF(OR(A2="",B2=""),"",A2-B2)
``````
and copy it down.

In D2 (for percentage change between Old and New Cost)
``````=IF(C2="","",B2/A2-1)
``````
and copy it down.

Experts Exchange Solution brought to you by

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

Director of Information TechnologyCommented:
@subodh

What is the -1 for?  This will skew the value off by 1.

Column with Number value - Blank  or Blank - Number value will just give the result a + or -.  From my POV the =IF(OR(A2="",B2=""),"",A2-B2) makes the formula much more complicated.
I think that the suggestion that I made is the cleanest and addresses whether A# or B# are blank without any worry if I missed something.  I know my screenshot has an incorrect formula, but I did acknowledge it after seeing Alan's spreadsheet.
Excel & VBA ExpertCommented:
That's the formula used for calculating the percentage change.
Excel & VBA ExpertCommented:
In other words, B2/A2-1 is equivalent to (B2-A2)/A2.
Director of Information TechnologyCommented:
Ok.
Author Commented:
AWESOME!  Thanks guys!
###### 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 Office

From novice to tech pro — start learning today.