Reputation: 313
I am trying to derive a formula which uses IF statements on pivot tables.
The goal is to perform IF functions on values when they do not EXIST. So far I have the following:
=IF(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0)=0,GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due"),IF(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due")=0,GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0),(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0)+GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due"))/1000))
The purpose of the formula is to see IF "this pivot data" DOES NOT exist
, then "Insert true value"
, then IF "this DIFFERENT pivot data" DOES NOT EXIST
, then "Insert true value"
, and the last false statement would be if both pivot data DO exist
.
Basically, how do I make a formula which indicates whether a pivot table value exists or not?
Upvotes: 0
Views: 7822
Reputation: 15923
The function you are looking for to find items that don't exist is ISBLANK
This would make your example function look like this:
=IF(ISBLANK(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0)),
GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due"),
IF(ISBLANK(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due")),
GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0),
(GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon",0)+GETPIVOTDATA("PO Outstanding Units",$A$2,"PO Horizon","Past Due"))/1000
)
)
If you need to check if a column exists, then MATCH will check that, and give an error if it doesn't exist, so, to test if Past Due is a column name, then
ISERROR(MATCH("Past Due",$A$2:$F$2,0))
will return TRUE if the column is not found (Adjust the $A$2:$F$2 to your pivot column name range)
Upvotes: 1