=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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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:

[TABLE="width: 119"]
<colgroup><col width="119"></colgroup><tbody>[TR]
[TD="width: 119"]OPL~EQ2~00053487[/TD]
[/TR]
</tbody>[/TABLE]

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
abc~def~zzzznop~qrstuv
ghij~klm~yyyghij~klm
nop~qrstuv~xxxxxx
rrrr
rrrr

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]#N/A[/TD]
[TD="align: right"][/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]2[/TD]
[TD="align: right"][/TD]

[TD="align: right"]2[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]

[TD="align: right"]3[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]4[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]5[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B1[/TH]
[TD="align: left"]=LOOKUP(2,1/(LEFT(A1,LEN($D$1:$D$5))=$D$1:$D$5),$E$1:$E$5)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,205
Members
452,618
Latest member
Tam84

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