ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If function returns #REF!, want it to return 0 (https://www.excelbanter.com/excel-worksheet-functions/124982-if-function-returns-ref-want-return-0-a.html)

rancher fred

If function returns #REF!, want it to return 0
 
I am trying to extract and sum data from a pivot table. In order to reduce
the number of formulas I am trying to nest the functions. My formula is as
follows:

=IF(GETPIVOTDATA("Meal",$A$3,"Formula #",175100,"Group
#",Sheet1!C2)="#REF!",0,GETPIVOTDATA("Meal",$A$3," Formula #",175100,"Group
#",Sheet1!C2))

Sometimes the logic test will result in a #REF! error because the Formula #
175100 is not present at every Group #. Instead of returning the #REF! error
I want it to return a 0. How do I achieve this?

JMB

If function returns #REF!, want it to return 0
 
try:
=IF(ISERROR(GETPIVOTDATA("Meal",$A$3,"Formula #",175100,"Group
#",Sheet1!C2)),0,GETPIVOTDATA("Meal",$A$3,"Form ula #",175100,"Group
#",Sheet1!C2))


"rancher fred" wrote:

I am trying to extract and sum data from a pivot table. In order to reduce
the number of formulas I am trying to nest the functions. My formula is as
follows:

=IF(GETPIVOTDATA("Meal",$A$3,"Formula #",175100,"Group
#",Sheet1!C2)="#REF!",0,GETPIVOTDATA("Meal",$A$3," Formula #",175100,"Group
#",Sheet1!C2))

Sometimes the logic test will result in a #REF! error because the Formula #
175100 is not present at every Group #. Instead of returning the #REF! error
I want it to return a 0. How do I achieve this?


MartinW

If function returns #REF!, want it to return 0
 
Hi Fred, try this

=IF(ISERROR(GETPIVOTDATA("Meal",$A$3,"Formula #",175100,"Group
#",Sheet1!C2)),0,GETPIVOTDATA("Meal",$A$3,"Form ula #",175100,"Group
#",Sheet1!C2))

HTH
Martin




All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com