Two way lookup where row isn't know?

MrPez

Board Regular
Joined
Jan 28, 2010
Messages
128
I need a formula to find a specific word in column A then find another word on that row, and then give me the column number that the second word is in.

So the first part would be =MATCH("Word1",A:A,0)

The second part would be =MATCH("Word2",Row:Row,0)
where Row is the result of the previous formula.

However, I'm struggling to combine the two formulae?
 

Some videos you may like

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.

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,981
Office Version
365, 2019, 2016
Platform
Windows
something like 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 /></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></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style="background-color: #E2EFDA;;">Word1</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="background-color: #E2EFDA;;">Word2</td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">11</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">13</td><td style="text-align: right;background-color: #E2EFDA;;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></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 /><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)">A13</th><td style="text-align:left">=MATCH(<font color="Blue">"Word2",INDEX(<font color="Red">A1:E10,MATCH(<font color="Green">"Word1",A1:A10,0</font>),0</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
 
Last edited:

MrPez

Board Regular
Joined
Jan 28, 2010
Messages
128
Kinda like that, but the column lookup for Word 2 must only use row 7 as there could be other instances of the same word elsewhere in A1:E10
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,981
Office Version
365, 2019, 2016
Platform
Windows
Kinda like that, but the column lookup for Word 2 must only use row 7 as there could be other instances of the same word elsewhere in A1:E10
that's what (MATCH("Word1",A1:A10,0)) trying to do

<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 /></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></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style="background-color: #E2EFDA;;">Word1</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="background-color: #E2EFDA;;">Word2</td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td><td style="text-align: right;background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">11</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">13</td><td style="text-align: right;background-color: #E2EFDA;;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></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 /><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)">A13</th><td style="text-align:left">=MATCH(<font color="Blue">"Word2",INDEX(<font color="Red">A1:E10,MATCH(<font color="Green">"Word1",A1:A10,0</font>),0</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
 
Last edited:

MrPez

Board Regular
Joined
Jan 28, 2010
Messages
128
Sorry, yes that works great :)
Thanks!
 

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,055
Office Version
2013
Platform
Windows
Does Alans's formula not still give a wrong answer if there is an intervening word eg Word3 in column B ????

I'm thinking you might need to tweak as per....

=MATCH("Word2",INDEX(A1:E10,MATCH("Word1",A1:A10,0),),0)
 

MrPez

Board Regular
Joined
Jan 28, 2010
Messages
128
Does Alans's formula not still give a wrong answer if there is an intervening word eg Word3 in column B ????

I'm thinking you might need to tweak as per....

=MATCH("Word2",INDEX(A1:E10,MATCH("Word1",A1:A10,0),),0)
Is that just to ensure an exact lookup?
Thanks both
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,981
Office Version
365, 2019, 2016
Platform
Windows
Is that just to ensure an exact lookup?
Thanks both
TBH, i'm not sure of Snakehips' suggestion or what it's trying to solve.

the match() in post#4 is looking for the exact match anyway
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,330
Office Version
365
Platform
Windows
@AlanY
Only the inner Match in your formula is an exact match. The outer Match does not have the final argument specified
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,981
Office Version
365, 2019, 2016
Platform
Windows
yes, got it.
thanks
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,101,759
Messages
5,482,704
Members
407,359
Latest member
aaawww

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