Pivot table, most recent dates, item with highest score

Adam_C

New Member
Joined
Jan 30, 2012
Messages
3
I have a data set with the following fields

Date
Member (3 specific members)
Game (fixed list of 20 games)
Score (integer)


I want to use a pivot table to show which out of 2 of the members had the highest score in each game played at the most recent date.

(Incidentally the games are all always played on the same date)

Ideally, the pivot table could be refreshed when the data is updated and not require any further manual manipulation.

Is this doable?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I have a data set with the following fields

Date
Member (3 specific members)
Game (fixed list of 20 games)
Score (integer)


I want to use a pivot table to show which out of 2 of the members had the highest score in each game played at the most recent date.

(Incidentally the games are all always played on the same date)

Ideally, the pivot table could be refreshed when the data is updated and not require any further manual manipulation.

Is this doable?

Well, it's doable but not without some automation and some additional steps.

First off, if you are constantly appending new data to your data set, then it's best to create a dynamic range and store it as a Named Range. If your data is only the four columns: Date, Member, Game and Score then I would create a named range using the following:

Code:
=Sheet1!$A$1:INDEX(Sheet1!$1:$65535, COUNTA(Sheet1!$A:$A), COUNTA(Sheet1!$1:$1))

Take this formula and go to Insert > Name > Define. Give your range a name and then paste the formula into the Refers to: section. Click ok. Now you've stored your range which you can then refer to in your Pivot Table range.

Secondly, it would require that you create a macro to automate both the refresh of your pivot table and the selection of the most recent date. Automating the refresh is just this simple code:

Code:
    Sub refresh_pivot()
'
'
    ActiveSheet.PivotTables("High Scorer").PivotCache.Refresh
 
End Sub

but in order to select the most recent date of your choosing, you'd need to create code to account for all of the various pivot items in your list and that's a little more time consuming. Because you would have to show as visible false, all of the pivot items you do not want to see for both the date field and the other member you do not want to see in the results.

Maybe if I have time I can help with that. How familiar with macros are you and if so, do know know how to create a form button to click on for both pivot table refresh as well as filtering the records you want to see?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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