Lookup a value and then find the largest in a range

fazthfc

New Member
Joined
May 6, 2015
Messages
4
Hi,

I have a set of data that looks like this:

Name12345
A121516106
B6415119
C2214131710
D687106
E8915264
F101419210
G1516202515
H162022108
I141619176

<tbody>
</tbody>

In another sheet I have the list of names but not in the same order (there is a reason for that). I want a formula that will look for the Name in column A and then return the largest number for that name in columns B:F.

For example:

Forumula looks at the name sees E and returns 26.

I've tried looking at HLOOKUP, MATCH and INDEX but can't find a way of looking at the range based on a specific criteria.

Any help greatly appreciated.
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,172
Hi,

I use the max formula on a line and set up the number of line with a match in the column. Indirect put them together.

Code:
=MAX(INDIRECT("Sheet1!$B$"&MATCH(Sheet2!A2;Sheet1!$A$1:$A$10)&":$F$"&MATCH(Sheet2!A2;Sheet1!$A$1:$A$10)))
I can go in more details if it does not work for you
 

RasGhul

Well-known Member
Joined
Jul 15, 2016
Messages
609
Hi faz,

Maybe this;

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Name</td><td style="text-align: right;;">1</td><td style="text-align: right;;">2</td><td style="text-align: right;;">3</td><td style="text-align: right;;">4</td><td style="text-align: right;;">5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">12</td><td style="text-align: right;;">15</td><td style="text-align: right;;">16</td><td style="text-align: right;;">10</td><td style="text-align: right;;">6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">B</td><td style="text-align: right;;">6</td><td style="text-align: right;;">4</td><td style="text-align: right;;">15</td><td style="text-align: right;;">1</td><td style="text-align: right;;">19</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">C</td><td style="text-align: right;;">22</td><td style="text-align: right;;">14</td><td style="text-align: right;;">13</td><td style="text-align: right;;">17</td><td style="text-align: right;;">10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">D</td><td style="text-align: right;;">6</td><td style="text-align: right;;">8</td><td style="text-align: right;;">7</td><td style="text-align: right;;">10</td><td style="text-align: right;;">6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">E</td><td style="text-align: right;;">8</td><td style="text-align: right;;">9</td><td style="text-align: right;;">15</td><td style="text-align: right;;">26</td><td style="text-align: right;;">4</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">F</td><td style="text-align: right;;">10</td><td style="text-align: right;;">14</td><td style="text-align: right;;">19</td><td style="text-align: right;;">2</td><td style="text-align: right;;">10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">G</td><td style="text-align: right;;">15</td><td style="text-align: right;;">16</td><td style="text-align: right;;">20</td><td style="text-align: right;;">25</td><td style="text-align: right;;">15</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style=";">H</td><td style="text-align: right;;">16</td><td style="text-align: right;;">20</td><td style="text-align: right;;">22</td><td style="text-align: right;;">10</td><td style="text-align: right;;">8</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style=";">I</td><td style="text-align: right;;">14</td><td style="text-align: right;;">16</td><td style="text-align: right;;">19</td><td style="text-align: right;;">17</td><td style="text-align: right;;">6</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br />

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Name</td><td style=";">Max</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">16</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">H</td><td style="text-align: right;;">22</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">C</td><td style="text-align: right;;">22</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">G</td><td style="text-align: right;;">25</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">E</td><td style="text-align: right;;">26</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">F</td><td style="text-align: right;;">19</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">D</td><td style="text-align: right;;">10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style=";">B</td><td style="text-align: right;;">19</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style=";">I</td><td style="text-align: right;;">19</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet2</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">{=MAX(<font color="Blue">IF(<font color="Red">Sheet1!$A$2:$A$10=A2,Sheet1!$B$2:$F$10</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />
 

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hello,

With your Table in Sheet1 ... and your formula in Sheet2 ...

Cell A2 : B

Cell B2 :
Code:
=MAX(OFFSET(Sheet1!$A$1,MATCH(A2,Sheet1!$A$2:$A$10,0),1):OFFSET(Sheet1!$A$1,MATCH(A2,Sheet1!$A$2:$A$10,0),5))
Hope this will help
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,543
Office Version
365
Platform
Windows
Another option

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Name</td><td style="text-align: right;;">1</td><td style="text-align: right;;">2</td><td style="text-align: right;;">3</td><td style="text-align: right;;">4</td><td style="text-align: right;;">5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">12</td><td style="text-align: right;;">15</td><td style="text-align: right;;">16</td><td style="text-align: right;;">10</td><td style="text-align: right;;">6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">B</td><td style="text-align: right;;">6</td><td style="text-align: right;;">4</td><td style="text-align: right;;">15</td><td style="text-align: right;;">1</td><td style="text-align: right;;">19</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">C</td><td style="text-align: right;;">22</td><td style="text-align: right;;">14</td><td style="text-align: right;;">13</td><td style="text-align: right;;">17</td><td style="text-align: right;;">10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">D</td><td style="text-align: right;;">6</td><td style="text-align: right;;">8</td><td style="text-align: right;;">7</td><td style="text-align: right;;">10</td><td style="text-align: right;;">6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">E</td><td style="text-align: right;;">8</td><td style="text-align: right;;">9</td><td style="text-align: right;;">15</td><td style="text-align: right;;">26</td><td style="text-align: right;;">4</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">F</td><td style="text-align: right;;">10</td><td style="text-align: right;;">14</td><td style="text-align: right;;">19</td><td style="text-align: right;;">2</td><td style="text-align: right;;">10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">G</td><td style="text-align: right;;">15</td><td style="text-align: right;;">16</td><td style="text-align: right;;">20</td><td style="text-align: right;;">25</td><td style="text-align: right;;">15</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style=";">H</td><td style="text-align: right;;">16</td><td style="text-align: right;;">20</td><td style="text-align: right;;">22</td><td style="text-align: right;;">10</td><td style="text-align: right;;">8</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style=";">I</td><td style="text-align: right;;">14</td><td style="text-align: right;;">16</td><td style="text-align: right;;">19</td><td style="text-align: right;;">17</td><td style="text-align: right;;">6</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br />

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">16</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">C</td><td style="text-align: right;;">22</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">F</td><td style="text-align: right;;">19</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">G</td><td style="text-align: right;;">25</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet3</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">=MAX(<font color="Blue">INDEX(<font color="Red">Sheet1!$B$2:$F$10,MATCH(<font color="Green">A2,Sheet1!$A$2:$A$10,0</font>),0</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,102,150
Messages
5,485,048
Members
407,479
Latest member
jbone2020

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top