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:

CodeMachCode
310=IF(MachData!$A$2,IF((ISNUMBER(SEARCH($A2,MachData!$B$2))),$A2,$A2&" "),$A2&" ")

<tbody>
</tbody>

MachData sheet:
UnattendedMachCodes
TRUE
1200;1300;1400;3100;9105

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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