How to get a default of 0 instead of #REF!

I have an Excel spreadsheet with several pivot table
Then I have a sheet which collects data from the pivit table
The issue I have is that if the value does not appear on the pivot table I get "
#REF! and then it will not give me a total
the formula is
=+GETPIVOTDATA("Total Hrs Cost",'By Month'!$A$1,"Month","MAR")

Can I modify this so that if the value does not appear on the pivot table it defaults to 0
Then I should be able to total the values

Gordon
Gordon HughesDirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

NorieAnalyst Assistant Commented:
Gordon

Which version of Excel (2007 or later I think are you on?

If it's a later version you can use IFERROR.

=IFERROR(GETPIVOTDATA("Total Hrs Cost",'By Month'!$A$1,"Month","MAR"),0)

For earlier version you could use ISERROR.

=IF(ISERROR(GETPIVOTDATA("Total Hrs Cost",'By Month'!$A$1,"Month","MAR")), 0, GETPIVOTDATA("Total Hrs Cost",'By Month'!$A$1,"Month","MAR"))
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
Hello ThereSystem AdministratorCommented:
It happens when cells that were referenced by formulas were deleted.
https://support.office.com/en-us/article/how-to-correct-a-ref-error-822c8e46-e610-4d02-bf29-ec4b8c5ff4be
0
Gordon HughesDirectorAuthor Commented:
Works ok and quick response
Thanks
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.