Xlook to find max value

hananak

Board Regular
Joined
Feb 10, 2022
Messages
110
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Dear All,

I am trying to do a look up value formula and my aim is to lookup the names and pick the highest daily rate.

I have a table where I haev list of names of people who worked on different days, same person's name is on this table multiple times but having different daily rates. e.g: Alex has worked on different days and had different daily rates. I have another table where I want to do look up to find Alex and give me the highest daily rate as outcome.

I have tried to use max function within xlookup but not working.

Agency Tracker.xlsx
HIJ
10Table 1
11NameDaily Rate
12Alex350
13David400
14Nur500
15Ruth600
16Alex500
17David800
18Nur900
19Ruth1000
20
21Result Table - VlookupResult I want
22NameDaily Rate
23Alex350The Highest Value from above Table
24David400The Highest Value from above Table
25Nur500The Highest Value from above Table
26Ruth600The Highest Value from above Table
Accrual Calculation
Cell Formulas
RangeFormula
I23:I26I23=VLOOKUP(H23,$H$12:$I$19,2,0)


Your help would be really appreciated.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
hello,

Try: ={MAX(IF($H$12:$H$19=H23,$I$12:$I$19))}

Xlookup only returns one value
 
Upvote 0
Or with 365 (as per your profile)
Book1
HIJ
10Table 1
11NameDaily Rate
12Alex350
13David400
14Nur500
15Ruth600
16Alex500
17David800
18Nur900
19Ruth1000
20
21Result Table - VlookupResult I want
22NameDaily Rate
23Alex500The Highest Value from above Table
24David800The Highest Value from above Table
25Nur900The Highest Value from above Table
26Ruth1000The Highest Value from above Table
Sheet3
Cell Formulas
RangeFormula
I23:I26I23=MAXIFS($I$12:$I$19,$H$12:$H$19,H23)
 
Upvote 1
Solution
I modified you question by specifying the range of names and values and the address of Alex and fed it to chatgpt. The following is the modified question and the result chatgpt gave. It first gave an answer same as kevin9999's. I told it I'm using Excel 2010. It then gave fgfdg456's answer.

question: "I am trying to do a look up value formula and my aim is to lookup the names and pick the highest daily rate. I have a table where I haev list of names of people who worked on different days, same person's name is on this table multiple times but having different daily rates. e.g: Alex has worked on different days and had different daily rates. I have another table where I want to do look up to find Alex and give me the highest daily rate as outcome. The range of the names is in H12:H19 and values are in I12:I19. please give me the formula for getting the highest daily rate. Alex is in H23, I have tried to use max function within xlookup but not working."

answer: "
You can use a combination of the MAX and IF functions to accomplish this. Here's an example formula that should work for your scenario:
=MAX(IF(H12:H19=H23,I12:I19))
This formula will check if each cell in the range H12:H19 matches the name "Alex" in H23. If there is a match, it will include the corresponding value in I12:I19 in the calculation. Finally, it will return the highest value from the resulting array using the MAX function.
Make sure to enter this formula as an array formula by pressing Ctrl + Shift + Enter after typing it in.
"
 
Upvote 0
A power query solution

Book1
ABCDE
1Table 1
2NameDaily RateNameMax Per Person
3Alex350Alex500
4David400David800
5Nur500Nur900
6Ruth600Ruth1000
7Alex500
8David800
9Nur900
10Ruth1000
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Daily Rate", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Max Per Person", each List.Max([Daily Rate]), type nullable number}})
in
    #"Grouped Rows"
 
Upvote 1
If each person's rate always gets higher as you move down Table 1 like your sample data (that is, you can get the highest rate by finding the last instance of the person's name) then you could get all the results with a single formula in cell I23 like this.

23 02 26.xlsm
HI
10Table 1
11NameDaily Rate
12Alex350
13David400
14Nur500
15Ruth600
16Alex500
17David800
18Nur900
19Ruth1000
20
21Result Table - Vlookup
22NameDaily Rate
23Alex500
24David800
25Nur900
26Ruth1000
Highest rate
Cell Formulas
RangeFormula
I23:I26I23=XLOOKUP(H23:H26,H12:H19,I12:I19,,,-1)
Dynamic array formulas.
 
Upvote 1
Use the 'MAXIFS' formula? Unless i'm missing something, this is an easy fix?

James.
 
Upvote 0
Ctrl shift enter for older versions of excel.
B14:

Excel Formula:
=MAX(IF(A14=$A$3:$A$10,$B$3:$B$10))
 

Attachments

  • 1677403857690.png
    1677403857690.png
    29.1 KB · Views: 79
Upvote 0
Use the 'MAXIFS' formula? Unless i'm missing something, this is an easy fix?

James.
Wasn't that already suggested in post #3?

Ctrl shift enter for older versions of excel.
B14:

Excel Formula:
=MAX(IF(A14=$A$3:$A$10,$B$3:$B$10))
Wasn't that already suggested in post #2 (only with the correct ranges)?
 
Upvote 0
If you sort the data, VLOOKUP does work:
1677412311592.png

There's also a DMAX solution, but it's not pretty:
Book1
HI
10Table 1
11NameDaily Rate
12Alex500
13Alex350
14David800
15David400
16Nur900
17Nur500
18Ruth1000
19Ruth600
20
21Result Table - DMAX
22NameDaily Rate
23Alex500
24David800
25Nur900
26Ruth1000
27
28NameDaily Rate
29=Alex>350
30
31NameDaily Rate
32=David>350
33
34NameDaily Rate
35=Nur>350
36
37NameDaily Rate
38Ruth>350
Sheet1
Cell Formulas
RangeFormula
I23I23=DMAX($H$11:$I$19,"Daily Rate",H28:I29)
I24I24=DMAX($H$11:$I$19,"Daily Rate",H31:I32)
I25I25=DMAX($H$11:$I$19,"Daily Rate",H34:I35)
I26I26=DMAX($H$11:$I$19,"Daily Rate",H37:I38)
H29H29="=Alex"
I29,I38,I35,I32I29=">"&MIN($I$12:$I$19)
H32H32="=David"
H35H35="=Nur"
H38H38="Ruth"

BTW, using Merge & Center really screws up the structure of a Worksheet. Not so much in this example, but generally a really bad idea. Better to use Center Across Selection in the Alignment options:

1677412560209.png

Those are 2016 solutions. For 365, MAXIFS is certainly the way to go, although if you're dealing with a lot more data the Power Query method is best and works in both versions.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
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