Isnumber Search Formula

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,516
Office Version
  1. 2016
Platform
  1. Windows
Hello All,

Here is the sample DATA in range (B2:B10)

[TABLE="width: 169"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Toyota[/TD]
[/TR]
[TR]
[TD]Suzuki[/TD]
[/TR]
[TR]
[TD]Suzuki[/TD]
[/TR]
[TR]
[TD]Yamaha[/TD]
[/TR]
[TR]
[TD]Toyota[/TD]
[/TR]
[TR]
[TD]Toyota[/TD]
[/TR]
[TR]
[TD]Suzuki[/TD]
[/TR]
[TR]
[TD]Ducati[/TD]
[/TR]
[TR]
[TD]Ducati[/TD]
[/TR]
</tbody>[/TABLE]

I want formula in Range (A2:A10)

I am using this formula in cell A2 to return 1 if the condition is met

Code:
[B]=IF(ISNUMBER(SEARCH($B$1,B2)),1,0)[/B]

All I want is to search if multiple entries are there in cell B1

For example To, Duca


Thanks in Advance

Regards,

Humayun
 
Ok, how about
Code:
Function hrayani(Cl As Range, Crit As Range) As Long
   Dim Sp As Variant
   Dim i As Long
   Sp = Split(Crit, ", ")
   hrayani = 0
   For i = 0 To UBound(Sp)
      If InStr(1, Cl, Sp(i), vbTextCompare) > 0 Then
         hrayani = 1
         Exit Function
      End If
   Next i
End Function
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi Fluff,

Working 100% OK. Exactly what I wanted....... PERFECT

Bunch of Thanks :)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
Hi Fluff,

You provided me this code few days back & that time it worked perfectly fine.

Code:
Function hrayani(Cl As Range, Crit As Range) As Long   Dim Sp As Variant
   Dim i As Long
   Sp = Split(Crit, ", ")
   hrayani = 0
   For i = 0 To UBound(Sp)
      If InStr(1, Cl, Sp(i), vbTextCompare) > 0 Then
         hrayani = 1
         Exit Function
      End If
   Next i
End Function

But now when I am applying this code to my data than its not working

When I use it for a single cell i.e. =hrayani(B2,$B$1) - it works fine

But when I apply a range i.e. =hrayani(B2:B10,$B$1) - its giving error value

Can you please help me out... what I am doing wrong. Coz I remeber that day it was working fine with the range of cells

Regards,

Humayun
 
Upvote 0
It's not designed to work on a range of cells, just 1.
You need to put the formula on each row in the sheet.
 
Upvote 0
My bad....

there you go.... I forgot to drag the formula down...
Bunch of thanks :)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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