View Full Version : Using IF statement with GETPIVOTDATA


flynjack
07-23-2008, 06:58 AM
Hell all;

I have an excel spreadsheet that is linked to a pivot table. The cell will reflect what ever the pivot reference link is behind it.
Here's my problem, if the link doesn't exist (Null) I want the cell to reflect "0" (Zero).
I assumed the following formula work but it doesn't

=IF(=GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1") Is Null, "0", =GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1"))

Any ideas on how to make this work would be appreciated. Thanks

Flynjack

namliam
07-23-2008, 07:06 AM
Dont use the extra = signs... = means the start of a formula in a cell, but once it is a formula, it says a formaly so you only need one = sign to start.

=IF(GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1") Is Null, "0", GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1"))

I think that should work.

flynjack
07-23-2008, 08:24 AM
Mailman;

Took out the "=" signs based on your recommendation. Unfotunatley, excel still doesn't like it. Any other ideas?

namliam
07-24-2008, 12:09 AM
I was so bussy tripping over your first problem I didnt notice the second...

"Is null" is a database thing, in excel you use "Isblank (CellReference)"

flynjack
07-24-2008, 05:52 AM
I have tried the Isblank command and it still doesn't work.

namliam
07-24-2008, 07:03 AM
Should work like a charm!

=IF(IsBlank(GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1 ")), "0", GETPIVOTDATA("SEAT AVAL",'ATRRS PIVOT'!$A$3,"MOS","13D1","FY","2009","QUARTER","Q1 "))

flynjack
07-24-2008, 02:08 PM
Got it to work with ISERR instead of ISBLANK. Thanks for the help.

shades
07-24-2008, 04:41 PM
Got it to work with ISERR instead of ISBLANK. Thanks for the help.

That's good. But be sure everything works as you intend in several scenarios, because in some contexts, ISERR (and other error functions) can obscure future problems.

(Note that ISERROR was the function used in 2000/2002/2003. Did this change with 2007?)