Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions > Cross Reference (OFFSET & MATCH)< Previous | Next > 

 

Cross referencing (or two way lookup) in a table (OFFSET and MATCH)

 
 

This assumes you want to cross reference by using a value in the first column and a value in the first row.

 
 

The VLOOKUP (and HLOOKUP) functions can only lookup values that are in the first column (or row) of a table.

 
 

You can lookup values (i.e. cross reference) in any column (or row) but this can only be done by putting two functions together.

 
 

There are several ways of obtaining the same result and one way is to combine the MATCH and OFFSET functions.

 
   
 

The OFFSET() function can be used to locate the exact cell within the table by offsetting from the top left corner.

 
 

The MATCH() function can be used to find the position of a value in a particular cell range.

 
 

The following formula will return the cross reference of a particular column heading with a particular row heading.

 
 
=OFFSET("top_left_cell",MATCH("col_item",C2:L2,0),MATCH("row_item",B3:B12,0))
 
 

"top_left_cell" is the cell in the top left corner of the table.

 
 

"col_item" is the heading that you want to find in the list of column headings (C2:L2).

 
 

"row_item" is the heading that you want to find in the list of row headings (B3:B12).

 
 

Remember you always go ACROSS and then DOWN when using this formula.

 

 

The following formula will return the cross reference of Aberdeen across and Bristol down.

 
 
=OFFSET($B$2,MATCH("Aberdeen",C2:L2,0),MATCH("Bristol",B3:B12,0)) = 513
 
 

The following formula will return the cross reference of Leeds across and London down.

 
 
=OFFSET($B$2,MATCH("Leeds",C2:L2,0),MATCH("London",B3:B12,0)) = 198
 

 

If you are having trouble creating this formula with all the right cell and range references you can use the Lookup Wizard add-in.

 
 

If anyone knows of any advantages or disadvantages with either of these two methods can they please contact us.

 

 

Cross referencing (or two way lookup) in a table (VLOOKUP and MATCH)

 
 

This assumes you want to cross reference by using a value in the first column and a value in the first row.

 
 

An alternative way to lookup values (i.e. cross reference) in any column (or row) is to combine the VLOOKUP and MATCH functions.

 
   
 

The VLOOKUP() function can be used to find the value in a column that matches a value in the first column of a table.

 
 

The MATCH() function can be used to find the position of a value in a particular cell range.

 
 

The following formula will return the cross reference of a particular column heading with a particular row heading.

 
 
=VLOOKUP("row_item",B2:L12,MATCH("col_item",B2:L2,0))
 
 

"row_item" is the heading that you want to find in the list of row headings (B3:B12).

 
 

"col_item" is the heading that you want to find in the list of column headings (C2:L2).

 
 

Notice that the row identifier is the first argument used.

 

 

The following formula will return the cross reference of Aberdeen across and Bristol down.

 
 
=VLOOKUP("Bristol",B2:L12,MATCH("Aberdeen",B2:L2,0)) = 513
 
 

The following formula will return the cross reference of Leeds across and London down.

 
 
=VLOOKUP("London",B2:L12,MATCH("Leeds",B2:L2,0)) = 198
 

 

Similarly you could combine the HLOOKUP and MATCH functions.

 
 

The HLOOKUP() function can be used to find the value in a row that matches a value in the first row of a table.

 
 

The MATCH() function can be used to find the position of a value in a particular cell range.

 
 

The following formula will return the cross reference of a particular column heading with a particular row heading.

 
 
=HLOOKUP("col_item",B2:L12,MATCH("row_item",B2:B12,0))
 
 

"col_item" is the heading that you want to find in the list of column headings (C2:L2).

 
 

"row_item" is the heading that you want to find in the list of row headings (B3:B12).

 

 

The following formula will return the cross reference of Aberdeen across and Bristol down.

 
 
=HLOOKUP("Aberdeen",B2:L12,MATCH("Bristol",B2:B12,0)) = 513
 
 

The following formula will return the cross reference of Leeds across and London down.

 
 
=HLOOKUP("Leeds",B2:L12,MATCH("London",B2:B12,0)) = 198
 

 Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >