Hi I am wondering here if somebody has a smart solution to solve the following issue I am facing.
I would like to write a VBAcode for sorting a pivottable based on both a pivotfielditem ("gcam") and a data sourcefield ("budget").
In the pivottable data I have two sourcefields called "forecast" and "budget". In rows, there are two pivottable fields: "measure" (such as gcam) and "country". Now I would like to have the countries sorted by the budgeted gcam (see numbers appearing in red), and keep the same order for the other item "volumes"
Below I tried to simulate the pivottable I am trying to produce. I know how to use advanced sorting on a single field, for example budget. But then the countries appear in a different order at the pivotitem "volumes" (Bahrain is the first to appear)
---------------------- Data
Measure Country Budget Forecast
Volumes Austria 6 6
Volumes Algeria 5 4
Volumes Bahrain 7 6
Volumes Antigua 4 3
Volumes Croatia 3 2
GCAM Austria 100 80
GCAM Algeria 90 60
GCAM Bahrain 80 70
GCAM Antigua 70 50
GCAM Bulgaria 60 20
GCAM Croatia 50 30
GCAM Bosnia 40 10
As usual, I appreciate very much any help you can give.
Emiel
I would like to write a VBAcode for sorting a pivottable based on both a pivotfielditem ("gcam") and a data sourcefield ("budget").
In the pivottable data I have two sourcefields called "forecast" and "budget". In rows, there are two pivottable fields: "measure" (such as gcam) and "country". Now I would like to have the countries sorted by the budgeted gcam (see numbers appearing in red), and keep the same order for the other item "volumes"
Below I tried to simulate the pivottable I am trying to produce. I know how to use advanced sorting on a single field, for example budget. But then the countries appear in a different order at the pivotitem "volumes" (Bahrain is the first to appear)
---------------------- Data
Measure Country Budget Forecast
Volumes Austria 6 6
Volumes Algeria 5 4
Volumes Bahrain 7 6
Volumes Antigua 4 3
Volumes Croatia 3 2
GCAM Austria 100 80
GCAM Algeria 90 60
GCAM Bahrain 80 70
GCAM Antigua 70 50
GCAM Bulgaria 60 20
GCAM Croatia 50 30
GCAM Bosnia 40 10
As usual, I appreciate very much any help you can give.
Emiel