Getpivotdata formula error retuning #ref

LucyWalker

New Member
Joined
May 3, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi

I work for a preschool in the UK and have developed my own spreadsheets and learnt how to insert pivot tables to run a number of reports.

I am stumped though.

I run a daily breakdown of children and staff so that we can ensure that we are staffed in the correct ratio of adults to children for each age group.

In the attached spreadsheet you will see I have Mon am session and Tues am session - in the boxes formatted orange the figures work absolutely perfectly for Mon AM but for Tue AM i keep getting the #REF error and I can't for the life of me work out why.

I have tried hunting for an if or formula wondering if when the figure is only 1 it for some reason doesn't or can't count it?

I am not an it guru nor a maths nerd just someone who has googled and come up with a system that works so any help in a very simply explained way would be really appreciated.

Thank you in advance
Lucy

Query formula work book get pivottable formula.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1Boys/GirlsStaff not on registerFirst NameLast NameEthinicityEALAL additional languageSEN2yr fundingExpected EYPP for child moving from 2yr funding to 3/4yr funding -economic groundsDisadvant/ S&LSessionDOBAgeStart Date & additional sessionsEnd date of sessionsFunding DateEligible 3yrs fundingShared Setting30 hrs fundingHours claimed at Bright Sparks UniversalHours claimed at Bright Sparks ExtendedHours claimed at Shared settingKey personHours Per Session13.00Staff HoursHealth NotesAvg temp
2girlsSarahSmithWBRIMon AM12/12/2019212/05/202131/03/20222.2Medical: Allergy to hazlenuts36.4c
3boysStanSmithWBRIMon AM01/02/2018412/05/202131/03/20224.1Medical: Allergy to hazlenuts36.4c
4girlsElizabeth*******WBRIMon AM25/06/2020112/05/202131/03/20221.7Medical: Allergy to hazlenuts36.4c
5girlsElizabeth*******WBRITue AM25/06/2020112/05/202131/03/20221.7Medical: Allergy to hazlenuts36.4c
6girlsSarahSmithWBRITue AM12/12/2014712/05/202131/03/20227.2Medical: Allergy to hazlenuts36.4c
7StaffLouiseJonesWBRIMon AM12/05/19784312/05/202131/03/202243.8Medical: Allergy to hazlenuts36.4c
8StaffLouiseJonesWBRITue AM12/05/19784312/05/202131/03/202243.8Medical: Allergy to hazlenuts36.4c
9
10
11
12
13End date of sessions(All)
14SessionMon AM
15Start Date & additional sessions(All)
16
17Boys/GirlsFirst NameLast NameDOBAgeEthinicityHealth NotesCount of Boys/GirlsCount of Health NotesCount of EALCount of AL additional languageCount of SENCount of 2yr fundingCount of Expected EYPP for child moving from 2yr funding to 3/4yr funding -economic groundsCount of Disadvant/ S&LCount of 30 hrs funding
18boysStanSmith01/02/20184WBRIMedical: Allergy to hazlenuts11
19boys Total11
20girlsSarahSmith12/12/20192WBRIMedical: Allergy to hazlenuts11
21girlsElizabeth*******25/06/20201WBRIMedical: Allergy to hazlenuts11
22girls Total22
23StaffLouiseJones12/05/197843WBRIMedical: Allergy to hazlenuts11
24Staff Total11
25
26
27
28Mon AM
29TOTAL NUMBER OF CHILDREN EXPECTED3
30TOTAL No of 18 month OLDS1
31TOTAL No of 2yr OLDS1
32Total No of 3/4yr OLDs1
33
34
35
36
37
Sheet1
Cell Formulas
RangeFormula
N2:N8N2=INT((TODAY()-M2)/365.25)
R2:R8R2=ROUNDDOWN((Q2-M2)/365.25,1)
A28A28=B14
B29B29=GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","boys")+GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","girls")
B30B30=COUNTIF($E:$E,1)
B31B31=COUNTIF($E:$E,2)
B32B32=COUNTIF($E:$E,3)+COUNTIF($E:$E,4)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L1Cellcontains a blank value textNO
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Welcome to the forum. :)

It doesn't look like you have any boys for Tues AM, so that first GETPIVOTDATA function will return an error. You can handle that with IFERROR:

Excel Formula:
=IFERROR(GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","boys"),0)+IFERROR(GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","girls"),0)
 
Upvote 0
Solution
Welcome to the forum. :)

It doesn't look like you have any boys for Tues AM, so that first GETPIVOTDATA function will return an error. You can handle that with IFERROR:

Excel Formula:
=IFERROR(GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","boys"),0)+IFERROR(GETPIVOTDATA("Count of Boys/Girls",$A$17,"Boys/Girls","girls"),0)
Hi Rory,

That is exactly right it only happended when I had one boy or one girl and i just couldn't work out where to put the iferror, or if it should be a greater than and a number of other random thingsetc etco_O Thank you so much for your speedy reply and it certainly works!!

Lucy (one happy Pivot table lady :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top