ISNUMBER(SEARCH problem

coop123

Board Regular
Joined
Dec 18, 2018
Messages
66
Office Version
  1. 365
I have a problem with the section of code below.

I am trying to put EHP in column F if customer begins with GB or PL or E.

If I only have if customer begins with GB or PL macro works, if I add additional criteria if customer begins with E it fails.
1665495465292.png

Range("F444").Select
ActiveCell.FormulaR1C1 = _
"=IF(OR(ISNUMBER(SEARCH(""GB"",RC[-5])),ISNUMBER(SEARCH(""PL"",RC[-5]))),ISNUMBER(SEARCH(""E"",RC[-5])))),""EHP"","""")"
1665495790039.png


Can someone please advise what mistake I have made, or is there another way to achieve putting EHP in column F if customer in column A starts with GB or PL or E.

There is code for the other customer ABC which works fine.

Thanks inadvance

Coop123
 

Attachments

  • 1665495196409.png
    1665495196409.png
    17.7 KB · Views: 2

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You have an extra closing bracket after looking for PL, it should be
VBA Code:
Range("F4").FormulaR1C1 = _
"=IF(OR(ISNUMBER(SEARCH(""GB"",RC[-5])),ISNUMBER(SEARCH(""PL"",RC[-5])),ISNUMBER(SEARCH(""E"",RC[-5]))),""EHP"","""")"
 
Upvote 0
Solution
Thank you Fluff.

Works perfectly now.

I had looked and looked at the line and could see what was wrong. Fresh pair of eyes solves the problem.

Thank you again.

Coop123
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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