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

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).

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,630
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,102,302
Messages
5,486,048
Members
407,529
Latest member
netojose

This Week's Hot Topics

Top