JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,687
- Office Version
- 365
- Platform
- Windows
I am working on a macro that will calculate the weighted ratings for a collection of products. Each product is given a "raw" rating on a number of features or properties. The macro will convert the raw ratings into Z Scores, apply a weighting factor, and then add them. The raw ratings are in a worksheet table. In addition to that, the macro needs two additional parameters for each property: the weighting factor and the order. The order indicates whether the ratings are HiLo (higher values are better) or LoHi (lower values are better).
Here's an example of 4 properties for electric vehicles:
The table (B9:G13) handles the properties nicely. In this example, the two helper rows containing the Weight and Order parameters are outside the table in rows 7 & 8. This works until I add, delete, or move a column in the table. The table columns all adjust automatically, but the helper rows do not. So I have to be careful to keep them in sync. That is a nuisance and error prone.
The other option I thought of is to move the two helper rows inside the table. That will keep them in sync, but it causes other problems, such as sorting.
Is there a way to handle this that is better than either of these two options?
Thanks
Here's an example of 4 properties for electric vehicles:
Weighted Ratings.xlsm | ||||||||
---|---|---|---|---|---|---|---|---|
B | C | D | E | F | G | |||
7 | Order | LoHi | HiLo | LoHi | HiLo | |||
8 | Weight | 1 | 2 | 2 | 1 | |||
9 | Car | WtdRtg | Price | Range | Avail | Headroom | ||
10 | A | ? | $34K | 300 mi | 0 mo | 5 in | ||
11 | B | ? | $54K | 320 mi | 3 mo | 3 in | ||
12 | C | ? | $63K | 350 mi | 9 mo | 7 in | ||
13 | D | ? | $76K | 420 mi | 0 mo | 8 in | ||
WtdRtg |
The table (B9:G13) handles the properties nicely. In this example, the two helper rows containing the Weight and Order parameters are outside the table in rows 7 & 8. This works until I add, delete, or move a column in the table. The table columns all adjust automatically, but the helper rows do not. So I have to be careful to keep them in sync. That is a nuisance and error prone.
The other option I thought of is to move the two helper rows inside the table. That will keep them in sync, but it causes other problems, such as sorting.
Weighted Ratings.xlsm | ||||||||
---|---|---|---|---|---|---|---|---|
B | C | D | E | F | G | |||
7 | Car | WtdRtg | Price | Range | Avail | Headroom | ||
8 | Order | LoHi | HiLo | LoHi | HiLo | |||
9 | Weight | 1 | 2 | 2 | 1 | |||
10 | A | ? | $34K | 300 mi | 0 mo | 5 in | ||
11 | B | ? | $54K | 320 mi | 3 mo | 3 in | ||
12 | C | ? | $63K | 350 mi | 9 mo | 7 in | ||
13 | D | ? | $76K | 420 mi | 0 mo | 8 in | ||
WtdRtg (xx) |
Is there a way to handle this that is better than either of these two options?
Thanks