(example attached) This "MATCH" formula correctly returns results in 90% of cases, but not in others.

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
790
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I have attached a file which demonstrates this. In my real document, I have about 3,000 rows. The formula in P is:

Code:
=COUNTIF(A2:L2,"*"&"tour:"&"*")>0

This works 100% of the time.

The formula in Q is:

Code:
=IFERROR(CELL("address",INDEX(A2:L2,MATCH("*"&"tour:"&"*",A2:L2,0))),"")

This works 90% of the time.



What it's doing is, in P, if in the range A2:L2 the phrase (with wildcards) "tour:" appears, it will return TRUE or FALSE
In Q, if in that same range "tour:" appears, it will give me the address of the cell that result appears in.


You can see on the example attached, it returns one cell, but not the other. I have no idea why this happens.


https://ufile.io/ptumm
 

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"
Possibly because the cell has more than 255 characters.
The Match function is returning #N/A
 
Upvote 0
Hi,

MATCH with a wildcard will not work on strings of more than 255 characters.

Switch to a SEARCH construction, i.e. for row 3, array formula**:

=IFERROR(CELL("address",INDEX(3:3,MATCH(TRUE,ISNUMBER(SEARCH("tour",A3:L3)),0))),"")

Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
 
Upvote 0
Hi,

MATCH with a wildcard will not work on strings of more than 255 characters.

Switch to a SEARCH construction, i.e. for row 3, array formula**:

=IFERROR(CELL("address",INDEX(3:3,MATCH(TRUE,ISNUMBER(SEARCH("tour",A3:L3)),0))),"")

Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

I'm reluctant to use an array formula over 3,000 examples of this, but thanks, maybe I will do a left,255 order as I'm sure the "tour" part I need is in the first half.


Nevermind, it works very quickly. Muchos gracias senor!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,838
Members
449,193
Latest member
MikeVol

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