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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

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,057
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,835
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,643
Messages
5,488,074
Members
407,622
Latest member
plantaddict

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top