Search a string in one cell for an exact match of a value from another cell

LearnNewThings

New Member
Joined
Aug 27, 2019
Messages
13
Office Version
  1. 365
Platform
  1. Windows
I have a formula that searches a string of text in one sheet, and sets the value of the cell where the formula is stored based on the true/false boolean results. The problem is, it will return true when it is a partial match instead of an exact match and I can't seem to find out how to only return true when it is exact. I have nested search and exact functions, but this isn't fixing the problem completely.

Ex: search criteria in sheet Dashboard cell A2 is the number 310, it searches a string (1200;1300;1400;3100;3200) in sheet MachData Cell B2 of and returns true because it found 310 within 3100. I only want it to return true if it finds 3100 exactly.

Any help is greatly appreciated.

Current formula which works for all values that are not "Similar" ie 310 & 3100, 910 & 9105, etc
=IF(MachData!$A$2,IF((ISNUMBER(SEARCH($A2,MachData!$B$2))),$A2,$A2&" "),$A2&" ")

Example of tables are below. I have conditional formatting to turn cell green if cell ISNUMBER. The cell turns green if either 310 or 910 are entered, even though those exact values are not in the string on the MachData page. In the example below, I want it to return a FALSE not TRUE.

Dashboard sheet:

[TABLE="class: grid, width: 600"]
<tbody>[TR]
[TD]Code[/TD]
[TD]MachCode[/TD]
[/TR]
[TR]
[TD]310[/TD]
[TD]=IF(MachData!$A$2,IF((ISNUMBER(SEARCH($A2,MachData!$B$2))),$A2,$A2&" "),$A2&" ")[/TD]
[/TR]
</tbody>[/TABLE]

MachData sheet:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Unattended[/TD]
[TD]MachCodes[/TD]
[/TR]
[TR]
[TD]TRUE[/TD]
[TD][TABLE="width: 166"]
<tbody>[TR]
[TD="width: 166"]1200;1300;1400;3100;9105[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi
Welcome to the board

Add the separator to the search

=ISNUMBER(SEARCH(";"&$A2&";",";"&MachData!$B$2&";"))
 
Upvote 0
Thank you so much! I figured I would need to include the separator, but wasn't sure of the Syntax to get it done.

Thanks!
 
Upvote 0
I'm having a similar issue. Is there a solution for non-numeric strings? For example the word Sun within Sunny does not return a match?
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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