Issue With Empty Text String Beig

denzo36

Board Regular
Joined
Sep 22, 2019
Messages
218
Office Version
  1. 365
Platform
  1. Windows
Hi folks,

I have a list of messy names that I need to compare to another messy list.

I've used a combo of TRIM and multiple nested SUBSTITUTE formulas to remove things like commas, spaces, slashes, full stops etc. See formula in cell Q2 below

1672832274098.png


I thought that would remove all unwanted text and spaces but when I use the SEARCH function to find an empty string, it's returning a 1 - I would have expected a 0 for this

1672832430829.png


Any ideas why this is?
 

Attachments

  • 1672832396282.png
    1672832396282.png
    6.9 KB · Views: 5

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
That will return a 1 for ANY non-empty string, regardless of how the string is created.
You are telling it to find an empty string within a non-empty string. I am not sure that makes much sense.

If you want to test to see if Q2 is empty, better to use something like:
Excel Formula:
=LEN(Q2)
or
Excel Formula:
=IF(Q2="",0,1)
 
Upvote 0
Thanks Joe,

The problem I'm having is I'm comparing 2 fields that can be similar but not quite the same and I'm trying to be as accurate as I can.

I've found the best approach is the use the IF, ISNUMBER and SEARCH as per below - but for cell T2 below I was hoping to return a FALSE as I'm trying to say, if the left 10 characters in Column S are found in Column Q then TRUE - when Column S is blank or an empty string I would have thought using the SEARCH for the empty string into a string that isn't empty would not return a 1 hence provide a FALSE to the IF.

Not sure there is a way around this then

1672834826448.png
 
Upvote 0
How about
Excel Formula:
=IF(S3="","",ISNUMBER(SEARCH(LEFT(S3,10),Q3)))
 
Upvote 0
How about
Excel Formula:
=IF(S3="","",ISNUMBER(SEARCH(LEFT(S3,10),Q3)))

Thanks Fluff, I think some combo of IF, OR and what I already have will do it for me actually
 
Upvote 0
Does that formula not work?
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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