[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Match formula

Posted on 2014-07-15
Medium Priority
190 Views
Hi,

I need need formula in cell AR2 that looks at the entry in AQ2, and looks that up against Col P in another workbook named "MappingTable.xls", and when a match is found returns the entry in Col G of "Mapping Table.xls", if no match is found, it should return "No PCM found"

Many thanks
0
Question by:Seamus2626

LVL 143

Expert Comment

ID: 40196377
if it was in the same workbook, this is the approach, in cel

=IF(ISNA(MATCH(AQ2;P:P;0));"No PCM found";OFFSET(G\$1;MATCH(AQ2;P:P;0)-1;0))

for the data being in the other workbook:

=IF(ISNA(MATCH(AQ2;'[MappingTable.xls]Sheet1'!P:P;0));"No PCM found";OFFSET('[MappingTable.xls]Sheet1'!G\$1;MATCH(AQ2;'[MappingTable.xls]Sheet1'!P:P;0)-1;0))
0

Author Comment

ID: 40196389
Thanks guty, im a gettig a syntax error on that one
0

LVL 8

Expert Comment

ID: 40196398
try this

=IF(INDEX('[Mapping Table.xls]Sheet1'!\$G:\$G,MATCH(AQ2,'[Mapping Table.xls]Sheet1'!\$P:\$P,0))=0,"No PCM Found",INDEX('[Mapping Table.xls]Sheet1'!\$G:\$G,MATCH(AQ2,'[Mapping Table.xls]Sheet1'!\$P:\$P,0)))
0

LVL 23

Assisted Solution

NBVC earned 2000 total points
ID: 40197001
OR (while other book is open):

=IFERROR(INDEX('[MappingTable.xls]Sheet1'!P:P,MATCH(AQ2,'[MappingTable.xls]Sheet1'!G:G,0)),"No PCM FOUND")

you can then close the other workbook, if desired.
0

Author Comment

ID: 40197166
itjockey: Your formula returns all #NA
NBVC; Your formula returns all "No PCM FOUND"

I am currently ussng a vlookup, where i have shifted the columns about, so to work a vlookup, but would prefer match formula - please note below is in VBA notation

=IFERROR(IF(VLOOKUP(A2,'[MappingTable.xlsm]GBM Mapping Table v4'!\$B:\$F,5,0)=0,""No Sub sector found"",VLOOKUP(A2,'[MappingTable.xlsm]GBM Mapping Table v4'!\$B:\$F,5,0)),""No Sub Sector found"")"

Thanks
0

LVL 23

Expert Comment

ID: 40197263
oops... I might have switched the references... try:

=IFERROR(INDEX('[MappingTable.xls]Sheet1'!G:G,MATCH(AQ2,'[MappingTable.xls]Sheet1'!P:P,0)),"No PCM FOUND")
0

Author Comment

ID: 40197280
I actually switched them over, but its still returning all "No PCM FOUND" !!
0

LVL 23

Accepted Solution

NBVC earned 2000 total points
ID: 40197417
Are you sure there is an exact match?  Look to see if you have spaces in the "matching cell".  Or are you matching numbers and the formats aren't both the same?  Also make sure the sheetname matches.
0

Author Closing Comment

ID: 40201473
All sorted guys, i used a vlookup in the end, thanks!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaacâ€¦
###### Suggested Courses
Course of the Month18 days, 8 hours left to enroll