Formula for looking the more nearest value

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
378
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
hi friends...


i have this data:

A1=Miguel Enriquez
A2=Jhon Smith Award
A3=Kevin Ramirez Torres
A4=Maria Rosas Torres
A5=Juan Carlos Rosas

if the user try looking: 'Kevin' i want return the value A3:Kevin Ramirez Torres or if try looking: Carlos: i want return: A5=Juan Carlos Rosas also if try find: Karlos would return too: A5=Juan Carlos Rosas or if try looking: Cmit, would return: A2=Jhon Smith Award or if try looking: Cevin: A3=Kevin Ramirez Torres

its possible?
if yes how to?

thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Interesting, just curious if someone will come up with a solution without VBA.
Wildcards could be used, but your query allows way too many variables:
ABCD
1Miguel Enriquez
2Jhon Smith Award
3Kevin Ramirez Torres
4Maria Rosas Torres
5Juan Carlos Rosas
6
7
8queryKevinSmithRosas
9result325

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B9=MATCH(B8&"*",A1:A5,0)
C9=MATCH("*"&C8&"*",A1:A5,0)
D9=MATCH("*"&D8,A1:A5,0)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Hello

Almost everything is possible, if you have a need to just find text, perhaps the CTRL+H search will be enough, in advance mode, it provide the position of record matching up the criteria.

With code, I made a simple set up.


Code:
Sub FindMyStr()

Dim Ws As Worksheet: Set Ws = ActiveSheet
Dim ranSource, ranFindCell As Range
Dim QueryTest As Variant: QueryTest = InputBox("Please Capture Name to find:")


Set ranSource = Range("A1:A100")
Set ranFindCell = ranSource.Find(QueryTest, , xlValues, xlPart)

' it is set with XlPart, so it will look for partial match and stop at the first match. For exact match up, use xlWhole.

If Not ranFindCell Is Nothing Then MsgBox " The record is in position A" & ranFindCell.Row


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,867
Members
449,053
Latest member
Mesh

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