Pivot Table w/IF Stmt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've been given an Access database that pulls data from an ODBC source. An
Excel file then links to Access tables. Below is an example of a formula on
an Excel spreadsheet - I am getting #REF errors because, I think, there is no
match in D16 in the pivot table which is because there's no data for either
January or February in the ODBC source. Is there a way to combine an IF
statement with the formula below to put a 0 in the cell so it doesn't error
off? Any other ideas? Any help would be so very much appreciated!! Jani
=GETPIVOTDATA("Recordable1",'Recordable
-CY'!$A$204,"Region",C16,"Location",B16,"Month_",E$4,"Division",D16)
 
as a worst case try

if(iserror(=GETPIVOTDATA("Recordable1",'Recordable
-CY'!$A$204,"Region",C16,"Location",B16,"Month_",E$4,"Division",D16)),0,=GETPIVOTDATA("Recordable1",'Recordable
-CY'!$A$204,"Region",C16,"Location",B16,"Month_",E$4,"Division",D16))
 
Thanks, Tom... but didn't work. I put an = sign in front of IF and took it
out before the GETs. Any other thoughts?
 
Tom - Can you tell I'm in way to much of a hurry to get this done? There is a
problem in that the formula always enters a 0. It is not picking up if there
is data. Thoughts??? Jani

"=IF(ISERROR(GETPIVOTDATA(""Recordable1"",'Recordable
-CY'!$A$204,""Region"",C16,""Location"",B16,""Month_"",E$4,""Division"",D16)),0,GETPIVOTDATA(""Recordable1"",'Recordable
-CY'!$A$204,""Region"",C16,""Location"",B16,""Month_"",E$4,""Division"",D16))"
 
If that doesn't work (and it may not - I never use GetPivotData - it is too
verbose for me)

Possibly you can use countif to see if the data you are looking for is
there. so as a general approach,

=if(sum(month(B1:B300)=1)=0,0,Getpivotformula)

entered with Ctrl+shift+Enter

in the =1, replace with Month(cell that contains a date with the month)

You know how your data is laid out and what you are looking for, so adapt
the approach to your specifics.
 
I'll give it a try, Tom. Thank you!

Tom Ogilvy said:
If that doesn't work (and it may not - I never use GetPivotData - it is too
verbose for me)

Possibly you can use countif to see if the data you are looking for is
there. so as a general approach,

=if(sum(month(B1:B300)=1)=0,0,Getpivotformula)

entered with Ctrl+shift+Enter

in the =1, replace with Month(cell that contains a date with the month)

You know how your data is laid out and what you are looking for, so adapt
the approach to your specifics.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top