EXCEL: Lookup characters, regardless of order?

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
Is this a possibility, to look up characters, regardless of order in cell?

Workbook:

If I'm trying to find John Smith:

if the list has Smith John, Smith John A, and John A. Smith, it'll still find it?

VBA Code:
=NOT(ISNA(MATCH(TRIM(SUBSTITUTE(F2,CHAR(160)," ")),TRIM(SUBSTITUTE($D$2:$D$997,CHAR(160)," ")),0)))

^Array formula

Thank in advance.

1602710054638.png

1602710063110.png
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Assuming the search text in cell F2 will always only be two "words" separated by a space, does this formula do what you want...
Excel Formula:
=NOT(ISERROR(IFERROR(SEARCH(SUBSTITUTE(F$2," ","*"),D2),SEARCH(MID(F$2&"*"&F$2,FIND(" ",F$2)+1,LEN(F$2)),D2))))
 
Upvote 0
no, it may be a variety of things, i heard vba has a fuzzy match ill be looking into
 
Upvote 0
no, it may be a variety of things...
Given we know nothing about your data, it would be kind of hard for us to guess what you mean by this. Can you post a fairly representative sample of whatever it is you are referring to here?


...i heard vba has a fuzzy match ill be looking into
You are probably referring to the Like operator. I would point out base on how you presented your first post that it appeared you were looking for a formula solution which is why I posted what I did. If you give us the example text that I asked for above, we may be in a better position to show you how to apply the Like operator to them.
 
Upvote 0
The screenshots are examples of the data and I linked the workbook example.

User input is various methods of

First Last
Last, First
First M. Last
Last First
Last First M.

I've redirected user input into First Last in a new cell but I can't edit this previously @Rick Rothstein
 
Upvote 0
User input is various methods of

First Last
Last, First
First M. Last
Last First
Last First M.
Okay, I see a problem. If you do not always use a comma when the order is Last First (like in your next to last example), then how is the code supposed to determine it needs to be reversed while First Last (also with no comma between the name parts) does not need to be reversed? To the code, they will both look the same... word-space-word.
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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