VBA_Newbie
Active Member
- Joined
- Jan 7, 2005
- Messages
- 258
Hi all,
I've got a tough one today. I have a program which outputs a plethora of results into excel spreadsheets. It's a special type of analysis known as TURF (total unduplicated reach & frequency). The problem is that is does not summarize the output that are on multiple worksheets. I'm hoping to create a macro to do exactly that, however, the criteria to summarize the information is rather complex. I was hoping one of the VBA gurus might be able to get me started.
I'll try to walk whomever is reading this and perhaps might be able to help me tackle this problem through the output.
Below is the output on a sheet called COMBO-1 (the sheets are always labeled the same):
Below is the output on a sheet called COMBO-2:
The program creates up to 11 sheets in the same manner (COMBO-1, COMBO-2...COMBO-11). The sheets COMBO-2 to COMBO-11 follow the same type of structure, whereas the sheet COMBO-1 is slightly different. The only difference between sheets COMBO-2 to COMBO-11 is that there are extra columns for the number of flavours. That is, in COMBO-2 there are 2 columns labelled Flavor_1 & Flavor_2, in Combo-3 there will be 3 columns labelled Flavor_1, Flavor_2, & Flavor_3, and so on and so on.
A short history of what you're looking at to make things more interesting:
TURF (Total Unduplicated Reach and Frequency) analysis is a technique used in marketing research to maximize the unduplicated reach of a product line while minimizing that product line’s depth. It was a technique originally used by media planners attempting to build ‘reach’ for an advertisement across vehicles (print, broadcast, etc.) without duplicating audiences. Now, it is often used to choose the product lines, flavor bundles, colors, scents, package sizes, etc., to offer to potential buyers. In this scenario, I'm trying to show the optimal number of flavours that will maximize the reach of the line of products. That is which combinations of flavour will appeal to the most people and still be reasonable to offer. For instance, there is a cut off point where adding a new flavour will only appeal to very small number of additional people, and thus may not be justified.
Now that I've got that out of the way, here's what I'm trying to accomplish.
I want to have a macro which creates a sheet called SUMMARY. On that sheet it will summarize certain information from each of the sheets labelled Combo-1 to Combo-11 as in the sheet below.
The algorithm needed to populate a summary table like the above would have to work something like this.
Find the flavor with maximum reach in COMBO-1 (the flavor for which the number under column called 'percent' is the highest) and insert that flavor (text string) in worksheet "SUMMARY", cell B2 to B12. Insert the reach of that flavor into M2.
In worksheet COMBO-2, find the flavor combination which has the flavor from COMBO-1 and a new flavor that has the highest reach. Insert that new flavour into C3 to C12 and insert the reach from the column percent-subset into M3.
In worksheet COMBO-3, find the flavor combination that contains both the flavor from COMBO-1 & the new flavor added from COMBO-2 & and a new flavor that has the highest reach. Insert this 3rd flavour into D3 - D12 and insent the reach from the column percent-subset into M4.
And so on for all sheets upto Combo-11.
I know this is a long post, and not many people will want to help me tackle this. But I'm open to any suggestions that will help get me started.
Many thanks,
Mike
I've got a tough one today. I have a program which outputs a plethora of results into excel spreadsheets. It's a special type of analysis known as TURF (total unduplicated reach & frequency). The problem is that is does not summarize the output that are on multiple worksheets. I'm hoping to create a macro to do exactly that, however, the criteria to summarize the information is rather complex. I was hoping one of the VBA gurus might be able to get me started.
I'll try to walk whomever is reading this and perhaps might be able to help me tackle this problem through the output.
Below is the output on a sheet called COMBO-1 (the sheets are always labeled the same):
OVERALL_REACH_RG.xls | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Col_name | Col_1-Rch | Percent | |||
2 | Plain_Rg | 625 | 34.34 | |||
3 | Garl_n_herbs_Rg | 613 | 33.68 | |||
4 | Fine_herbs_Rg | 608 | 33.41 | |||
5 | Brie_ch_Rg | 520 | 28.57 | |||
6 | Swiss_ch_Rg | 515 | 28.3 | |||
7 | Garden_veg_Rg | 454 | 24.95 | |||
8 | tom_n_basil_Rg | 446 | 24.51 | |||
9 | Fr_onions_Rg | 444 | 24.4 | |||
10 | Brie_n_cran_Rg | 408 | 22.42 | |||
11 | Goat_ch_Rg | 381 | 20.93 | |||
12 | Blue_ch_Rg | 311 | 17.09 | |||
Combo-1 |
Below is the output on a sheet called COMBO-2:
OVERALL_REACH_RG.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Flavor_1 | Flavor_2 | Complem-Rch | Subset-Rch | Percent-Subset | ||
2 | Plain_Rg | Garl_n_herbs_Rg | 1238 | 878 | 48.24 | ||
3 | Plain_Rg | Fine_herbs_Rg | 1233 | 862 | 47.36 | ||
4 | Plain_Rg | Brie_ch_Rg | 1145 | 819 | 45 | ||
5 | Plain_Rg | Brie_n_cran_Rg | 1033 | 812 | 44.62 | ||
6 | Plain_Rg | tom_n_basil_Rg | 1071 | 803 | 44.12 | ||
7 | Swiss_ch_Rg | Garl_n_herbs_Rg | 1128 | 797 | 43.79 | ||
8 | Brie_ch_Rg | Garl_n_herbs_Rg | 1133 | 792 | 43.52 | ||
9 | Plain_Rg | Swiss_ch_Rg | 1140 | 791 | 43.46 | ||
10 | Plain_Rg | Fr_onions_Rg | 1069 | 788 | 43.3 | ||
11 | Plain_Rg | Garden_veg_Rg | 1079 | 786 | 43.19 | ||
12 | Swiss_ch_Rg | Fine_herbs_Rg | 1123 | 784 | 43.08 | ||
13 | Brie_ch_Rg | Fine_herbs_Rg | 1128 | 783 | 43.02 | ||
14 | Plain_Rg | Goat_ch_Rg | 1006 | 781 | 42.91 | ||
Combo-2 |
The program creates up to 11 sheets in the same manner (COMBO-1, COMBO-2...COMBO-11). The sheets COMBO-2 to COMBO-11 follow the same type of structure, whereas the sheet COMBO-1 is slightly different. The only difference between sheets COMBO-2 to COMBO-11 is that there are extra columns for the number of flavours. That is, in COMBO-2 there are 2 columns labelled Flavor_1 & Flavor_2, in Combo-3 there will be 3 columns labelled Flavor_1, Flavor_2, & Flavor_3, and so on and so on.
A short history of what you're looking at to make things more interesting:
TURF (Total Unduplicated Reach and Frequency) analysis is a technique used in marketing research to maximize the unduplicated reach of a product line while minimizing that product line’s depth. It was a technique originally used by media planners attempting to build ‘reach’ for an advertisement across vehicles (print, broadcast, etc.) without duplicating audiences. Now, it is often used to choose the product lines, flavor bundles, colors, scents, package sizes, etc., to offer to potential buyers. In this scenario, I'm trying to show the optimal number of flavours that will maximize the reach of the line of products. That is which combinations of flavour will appeal to the most people and still be reasonable to offer. For instance, there is a cut off point where adding a new flavour will only appeal to very small number of additional people, and thus may not be justified.
Now that I've got that out of the way, here's what I'm trying to accomplish.
I want to have a macro which creates a sheet called SUMMARY. On that sheet it will summarize certain information from each of the sheets labelled Combo-1 to Combo-11 as in the sheet below.
OVERALL_REACH_RG.xls | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | |||
1 | COMBO | Flavour_1 | Flavour_2 | Flavour_3 | Flavour_4 | Flavour_5 | Flavour_6 | Flavour_7 | Flavour_8 | Flavour_9 | Flavour_10 | Flavour_11 | REACH | ||
2 | 1 | Plain_Rg | 34.34 | ||||||||||||
3 | 2 | Plain_Rg | Garl_n_herbs_Rg | 48.24 | |||||||||||
4 | 3 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ||||||||||
5 | 4 | Plain_Rg | Garl_n_herbs_Rg | ????? | ?????? | ????? | |||||||||
6 | 5 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ||||||||
7 | 6 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | |||||||
8 | 7 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | ????? | ||||||
9 | 8 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | ????? | ????? | |||||
10 | 9 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ||||
11 | 10 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | |||
12 | 11 | Plain_Rg | Garl_n_herbs_Rg | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ????? | ||
SUMMARY |
The algorithm needed to populate a summary table like the above would have to work something like this.
Find the flavor with maximum reach in COMBO-1 (the flavor for which the number under column called 'percent' is the highest) and insert that flavor (text string) in worksheet "SUMMARY", cell B2 to B12. Insert the reach of that flavor into M2.
In worksheet COMBO-2, find the flavor combination which has the flavor from COMBO-1 and a new flavor that has the highest reach. Insert that new flavour into C3 to C12 and insert the reach from the column percent-subset into M3.
In worksheet COMBO-3, find the flavor combination that contains both the flavor from COMBO-1 & the new flavor added from COMBO-2 & and a new flavor that has the highest reach. Insert this 3rd flavour into D3 - D12 and insent the reach from the column percent-subset into M4.
And so on for all sheets upto Combo-11.
I know this is a long post, and not many people will want to help me tackle this. But I'm open to any suggestions that will help get me started.
Many thanks,
Mike