Can't Find Summed Value of 2 Largest Numbers in Vlookup

bencar

Banned user
Joined
Jun 8, 2016
Messages
149
I'm trying to use vlookup to lookup a value that sums up the 2 largest numbers in columns B,C and D. I tried these 2 formulas on my own but thet dont work. I also tried using them as array functions. But still doesnt work. How can I make this work?

=sum(VLOOKUP(E9,A2:D5,{LARGE(B2:D2,{1,2})},0))
=sum(VLOOKUP(E9,A2:D5,(LARGE(B2:D2,{1,2}),0))



ABCD
Daniel
Richard
Matt
Stevie

<tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #002060"]Thrower[/TD]
[TD="bgcolor: #002060"]Throw 1[/TD]
[TD="bgcolor: #002060"]Throw 2[/TD]
[TD="bgcolor: #002060"]Throw 3[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]45.99[/TD]
[TD="align: right"]23.78[/TD]
[TD="align: right"]51.02[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]40.22[/TD]
[TD="align: right"]42.32[/TD]
[TD="align: right"]43.69[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]37.55[/TD]
[TD="align: right"]34.2[/TD]
[TD="align: right"]31.5[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]69.43[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]56.11[/TD]

</tbody>

 
Last edited:
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Why do you ‘need’ to use vlookup ?

What kind of question is that?

Because that's how it is formulated in the assignment.

An assignment??

Hi!

If I understand correctly what you want, then the formulas below can helps:

Use Ctrl+Shift+Enter to enter the formula

=SUM(LARGE(VLOOKUP(E9,$A$2:$D$5,{2;3;4},0),{1;2}))

Markmzz


Hi markmzz,

Appreciate the reply. Thats the answer I want. But why is '{1;2}' at the end? Shouldn't it substitute the column index number?

Why is it written as, '=SUM(LARGE(VLOOKUP?' Why not, '=SUM(VLOOKUP(LARGE?'

And how would I know this was an array function as opposed to a function?
 
Last edited:
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Why do you ‘need’ to use vlookup ?
What kind of question is that?
A Pretty standard, and very common one on support forums like this.

Believe it or not, we're all trying to help you.
Focusing on what you think the solution should be is counter productive to solving your problem.
You're overlooking perfectly suitable solutions to your task at hand, and ignoring them because they don't look like what you think the solution should be.
Did you even consider that vlookup might not be the best tool for the job?

We're not here to do your bidding. We are here to help you find solutions to a problem.
"I want to use vlookup to do xyz" is not a 'problem'. It's a solution seeking a problem.

"I want to find the sum of the 2 largest values for the name in E9", That is a 'Problem'.
The suggested solutions using index and match is a solution to that problem.


You don't take your car to an auto mechanic and say "I want to use this distributor cap to solve my poorly running engine". Then when the mechanic says "the problem isn't the distributor cap, it's your clogged fuel injectors". Do you then say, "but why can't you use the distributor cap to fix it?"

If you don't know what the actual solution is (this thread wouldn't exist if you did), how can you so easily dismiss suggestions ?
 
Last edited by a moderator:
Upvote 0
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Hi markmzz,

Appreciate the reply. Thats the answer I want. But why is '{1;2}' at the end? Shouldn't it substitute the column index number?

Why is it written as, '=SUM(LARGE(VLOOKUP?' Why not, '=SUM(VLOOKUP(LARGE?'

And how would I know this was an array function as opposed to a function?

Hi!

I will try to expain.

Lets go:

1) {1;2} is used to get the first and second highest values found by the VLOOKUP function.

2) Because first I need to get the wanted value for related values after calculating the first and second largest values. For Example: First a lookup Daniel and found 45.99, 23.78 and 51.02. After that, calculating the first and second largest value 45.99 and 51.02<strike></strike>. And finally, calculete the sum.

3) Because the VLOOKUP function with the argument {2;3;4} get initially three values( array) to not only a single value.

I hope that this helps.

By the way,
Jonmo1's remark is correct. The Index and Match function do the job too.

Markmzz
 
Upvote 0
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Believe it or not, we're all trying to help you.
Focusing on what you think the solution should be is counter productive to solving your problem.

Yes I agree with you and for the most part youre correct. But if I ask for vlookup countless times upon answers that have nothing to do with it, something's not right here, unless vlookup is impossible to apply to my issue which obviously its not.

I'm not trying to give you a hard time. I do appreciate your help and presence on my thread, youre a very smart man. But I did want vlookup.


Hi!


1) {1;2} is used to get the first and second highest values found by the VLOOKUP function.

2) Because first I need to get the wanted value for related values after calculating the first and second largest values. For Example: First a lookup Daniel and found 45.99, 23.78 and 51.02. After that, calculating the first and second largest value 45.99 and 51.02<strike></strike>. And finally, calculete the sum.

3) Because the VLOOKUP function with the argument {2;3;4} get initially three values( array) to not only a single value.

I hope that this helps.

By the way,
Jonmo1's remark is correct. The Index and Match function do the job too.

Markmzz

Hi markmzz,

1) Yes I know {1;2} is used for getting the first and second highest values. But I want to know isn't it in the 'column index number' part of vlookup? After all its where the columns need to be referenced in the vlookup cormula.

2) But shouldnt the order of operation be 1st, find the largest 2 values.. 2nd sum them.. lastly, look them up.

3) WHat dio you mean by, "with the argument {2;3;4} get initially three values( array)". Are youre saying when i add a function into vlookup it automatically becomes an array function? Could you explaijn this and how would I know how to recognize an array function?

Lastly... why is $A$2:$D$5 in absolute and not relative reference?

 
Upvote 0
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Hi markmzz,

1) Yes I know {1;2} is used for getting the first and second highest values. But I want to know isn't it in the 'column index number' part of vlookup? After all its where the columns need to be referenced in the vlookup cormula.

2) But shouldnt the order of operation be 1st, find the largest 2 values.. 2nd sum them.. lastly, look them up.

3) WHat dio you mean by, "with the argument {2;3;4} get initially three values( array)". Are youre saying when i add a function into vlookup it automatically becomes an array function? Could you explaijn this and how would I know how to recognize an array function?

Lastly... why is $A$2:$D$5 in absolute and not relative reference?

Hi!

Lets try again (now with steps):


[TABLE="class: grid, width: 953"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Thrower[/TD]
[TD]Throw 1[/TD]
[TD]Throw 2[/TD]
[TD]Throw 3[/TD]
[TD][/TD]
[TD]Thrower[/TD]
[TD]Result[/TD]
[TD][/TD]
[TD]Formula for Daniel[/TD]
[TD]=SUM(LARGE(VLOOKUP(F2,$A$2:$D$5,{2;3;4},0),{1;2}))[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Daniel[/TD]
[TD="align: right"]45,99[/TD]
[TD="align: right"]23,78[/TD]
[TD="align: right"]51,02[/TD]
[TD][/TD]
[TD]Daniel[/TD]
[TD="align: right"]97,01[/TD]
[TD][/TD]
[TD]Step 1[/TD]
[TD]VLOOKUP("Daniel",$A$2:$D$5,{2;3;4},0) - in this part of the formula, I will used the VLOOKUP function to get the values of the col 2, col 3 and col 4 ({2;3;4}) of the row of Daniel (first row - A2:D2) in the range $A$2:$D$5 ({45,99;23,78;51,02}). The range $A$2:$D$5 must to be absolute because I will copy down the formula (for Richard, Matt and Stevie).[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Richard[/TD]
[TD="align: right"]40,22[/TD]
[TD="align: right"]42,32[/TD]
[TD="align: right"]43,69[/TD]
[TD][/TD]
[TD]Richard[/TD]
[TD="align: right"]86,01[/TD]
[TD][/TD]
[TD]Step 2[/TD]
[TD]LARGE({45,99;23,78;51,02},{1;2}) - in this part of the formula, I will used the LARGE function to get the first and the second ({1;2}) largest values of the values 45,99; 23,78 and 51,02 that I get with the VLOOKUP function ({51,02;45,99}).[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Matt[/TD]
[TD="align: right"]37,55[/TD]
[TD="align: right"]34,2[/TD]
[TD="align: right"]31,5[/TD]
[TD][/TD]
[TD]Matt[/TD]
[TD="align: right"]71,75[/TD]
[TD][/TD]
[TD]Step 3[/TD]
[TD]=SUM({51,02;45,99}) - in this part of the formula, I will used the SUM function to sum the values that I get with the LARGE function 51,02 and 45,99.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Stevie[/TD]
[TD="align: right"]69,43[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]56,11[/TD]
[TD][/TD]
[TD]Stevie[/TD]
[TD="align: right"]125,54[/TD]
[TD][/TD]
[TD]Step 4[/TD]
[TD]=97,01 - in this part of the formula, I will get the final value.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]***[/TD]
[TD]********[/TD]
[TD]********[/TD]
[TD]********[/TD]
[TD]********[/TD]
[TD]**[/TD]
[TD]*********[/TD]
[TD]********[/TD]
[TD]**[/TD]
[TD]******************[/TD]
[TD]*******************************************************[/TD]
[TD]**[/TD]
[/TR]
</tbody>[/TABLE]


I hope that this helps.

Markmzz
 
Upvote 0
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

1) Why is
[COLOR=var(--Font-dark-background-light-text-add-on-fg)!important][COLOR=var(--Font-dark-background-light-text-add-on-fg)!important]$A$2:$D$5 [/COLOR]in absolute reference? Why not relative reference?

2) Why are there semi-colons between the values? Why not commas?
[/COLOR]​
 
Upvote 0
Re: How Do I Find Summed Values of 2 Largest Numbers in Vlookup

Hi Killz,

Questions:

1) Why do you say $A$2:$D$5 must to be absolute to copy down the formula (for Richard, Matt and Stevie)? Its a table array. Table arrays arent "copied down." How are you copying a table array?

2) Why do you use semi-colons in between the values? Why not commas?

Answers:

Lets go:

1) If you use relative reference (A2:D5), look at you will get below when you copy the formula in G2 (=SUM(LARGE(VLOOKUP(F2,A2:D5,{2;3;4},0),{1;2}))) down:

=SUM(LARGE(VLOOKUP(F3,A3:D6,{2;3;4},0),{1;2}))
=SUM(LARGE(VLOOKUP(F4,A
4:D7,{2;3;4},0),{1;2}))
=SUM(LARGE(VLOOKUP(F5,A
5:D8,{2;3;4},0),{1;2}))

The result is ok in this case (not the formula), but if you change the data in the rows in the range A2:D5 you will have problem. Try it and tell me the results.

2) I can use semi-colons (;) and commas (,) in this case. Example: I can use {2;3;4} and {1;2} or I can use {2,3,4} and {1,2}. Try it and tell me the results.

I hope that this helps.

Markmzz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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