=MATCH Function not working even when =A1=A2=TRUE

Ecologic

New Member
Joined
Sep 25, 2018
Messages
4
I've been using Excel/VBA for years and I haven't ever come across something this frustrating.

I have a formula (see below), that results in #N/A because the MATCH function fails. I have checked formatting, TRIM() for spaces, and a CHAR() by CHAR() breakdown as well as using =cell=cell and got TRUE. Google hasn't been helpful. Please help!

Code:
=IF(A2="","",IF(L2="0",INDEX(Tables!$L$3:$L$100,MATCH(LEFT(J2,FIND("!",SUBSTITUTE(J2,"~","!",2))-1),Tables!$K$3:$K$100,0)),"Project"))

Basically I'm trying to take a department name in a table, take a portion of the name out as a string, and then match that to a lookup table and display the proper name for the department from that list.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Some Screenshots. Cell V2 is using the formula above with exact match parameter (0). Cell below is using a parameter of (1), while this works most of the time, I don't get why the exact match doesn't work.
nEjmrp
dqgAHU
 
Upvote 0
Welcome to the MrExcel forum.

The only thing I see offhand is that the formula is looking in columns K:L on the Tables sheet, but your picture of the Tables sheet has the table in N:O.
 
Upvote 0
Using the first code in your list:

OPL~EQ2~00053487

<colgroup><col width="119"></colgroup><tbody>
</tbody>

Try to convert it to:

OPL~~EQ2

to find your match.
 
Upvote 0
steve the fish raises a good point. ~ is used as a special wildcard character in such functions as MATCH or SUMIF. When found in your data, it confuses MATCH. You can double it as he says, or use SUBSTITUTE to change it to something else, or use a different formula that doesn't use MATCH, like:

ABCDEF
1abc~def~zzzz#N/Anop~qrstuv1
2ghij~klm~yyy2ghij~klm2
3nop~qrstuv~xxx1xxx3
4rrrr4
5rrrr5

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B1=LOOKUP(2,1/(LEFT(A1,LEN($D$1:$D$5))=$D$1:$D$5),$E$1:$E$5)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,935
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top