Nesting Countif and getpivotdata

Guruprasad Rao

New Member
Joined
Sep 27, 2013
Messages
6
Hi,

I am having problems with my report generation, earlier we were using multiple pivots to build a single report, which was time consuming. I have sorted out most of the problems by building a single pivot and using getpivotdata. But one of the few problems I have now is with getting the count of days from the pivot.

Below is the extract from the pivot:

Values
ClassDateResult
Count of Date
2B -Sc - G1
21/07/201329.24
22/07/201323.64
23/07/201324.94
24/07/201335.25
25/07/201327.84
26/07/201325.34
27/07/201327.44
28/07/201332.45
29/07/201326.14
30/07/201337.75
31/07/201328.94
2B - Sc -G1 Total
318.547

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>

If I use getpivotdata and use "Count of Date" as basis i would get 47, (No of students is not constant this varies from 3 to 12).

I want the resultant to be 11 for Class - 2B - Sc - G1 in my report.

I hope this forum would help me in resolving this problem.

Thanks
G Rao
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi, and welcome to the forum.

Which version of Excel are you using?
 
Upvote 0
Shame. IN that case you'll need a formula like this:
=LOOKUP(2,1/(A1:A100=F2&" Total"),ROW(A1:A100))-MATCH(F2,A1:A100,0)
where F2 contains the Class name. You may need to adjust the ranges - just make them bigger than your table will ever be, but preferably not entire columns.
 
Upvote 0
With 2010 you can choose to repeat the Class item label and then just use COUNTIF.
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,367
Members
449,080
Latest member
Armadillos

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