Vlookup and Weighted Averages

head2442

New Member
Joined
Apr 20, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Need some help here! Two part question here possibly. I am not very efficient with excel yet so please bear with me!
I hope the sample file link works, if not I attached an image where I combined sheet 1 and 2 into one to show an idea of what I am working with.

SAMPLE FILE

1. I need to find the weighted averages for multiple lines. I know to use the =SUMPRODUCT formula /SUM however, the issue I am having is, there are over 2,000 lines.
The only way I know how to do this is to enter the formula manually each time for each group of the same names. And that would take FOREVER to complete. I know there has to be a formula or way where it can find all the matching names, take the weights and rates and provide me the average weight! In the sample file I have more simplified than what I am working with, again I have a sheet with 2,000+ rows.
Is there an easy way to find the weighted average easily with a formula that can automatically find all the lines with the same name, then take the weight and rate and give me the weighted average?

2. If above is possible, then I could just simply create a pivot table and then vlookup the weighted averages. If not, then is there a way to vlookup the names, then provide me with the weighted average going off the weights and rates?


Thank you so much!
 

Attachments

  • sampleweightedaverage.jpg
    sampleweightedaverage.jpg
    72.4 KB · Views: 64

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Welcome to the MrExcel forum!

Maybe:

Book2
ABCDEFGH
1NameWeighted AverageWeight Rate Helper
2James377.5487John50$ 45.00$ 2,250.00
3John33.5122Mark24$ 57.001368
4Mark62.81818James12$ 45.00540
5Mary33.23448Redditor256$ 585.00149760
6Max118.2921Mary234$ 2.00468
7Redditor174.7709Max22$ 3.0066
8John36$ 36.001296
9Mark86$ 69.005934
10James33$ 5,211.00171963
11Redditor679$ 25.0016975
12Mary35$ 211.007385
13Max65$ 158.0010270
14John78$ 25.001950
15Mark22$ 45.00990
16James458$ 38.0017404
17Redditor34$ 77.002618
18Mary21$ 85.001785
19Max2$ 96.00192
Sheet2
Cell Formulas
RangeFormula
A2:B7A2=LET(rng,$E$2:$H$19,n,SORT(UNIQUE(INDEX(rng,0,1))),CHOOSE({1,2},n,SUMIF(INDEX(rng,0,1),n,INDEX(rng,0,4))/SUMIF(INDEX(rng,0,1),n,INDEX(rng,0,2))))
H2:H19H2=F2:F19*G2:G19
Dynamic array formulas.


I added the helper column in column H. I could probably figure out how to include it in the formula, but it would be more complicated and computationally intensive. Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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