If Is Equal To

tomgrandy

New Member
Joined
May 10, 2024
Messages
41
Office Version
  1. 365
Platform
  1. MacOS
Currently I have a string as:

If InStr(cell.Value, "DRILL") <> 0 Then
cell.Offset(0, 7).Value = "POINT"
End If

It needs to read that if that cell value equals DRILL then write the value of POINT

Problem that I am encountering is that where the descriptions it is reading for values from has the word "Drilled" as in a tooth that was drilled (not a Point) that is shows another value.

So, how do I rewrite the above to ONLY pick up Drill and not Drilled?

Thanks in advance,

Tom
 
Don't know about more efficient but maybe easier to write (Change myCell to suit)

VBA Code:
    Dim MyArr, MyArr2, myCell As Range
    Dim MyFind As Integer, MyFind2 As Integer

    Set myCell = Range("A4")

    MyArr = Array("PENDANT", "GORGET")
    MyArr2 = Array("BANNERSTONE", "BANNERS", "LOAFSTONE", "BAR AMULET")

    For MyFind = LBound(MyArr) To UBound(MyArr)
        If InStr(myCell.Value, " " & MyArr(MyFind) & " ") > 0 Then myCell.Offset(0, 8).Value = "PENDANT AND GORGETS"
    Next
       
    For MyFind2 = LBound(MyArr2) To UBound(MyArr2)
        If InStr(myCell.Value, " " & MyArr2(MyFind2) & " ") > 0 Then myCell.Offset(0, 8).Value = "BANNERSTONES & ATL-ATL WEIGHTS"
    Next
Definitely easier! Will save this for future reference - needless to say I am just learning and people like you have been so helpful.

Thanks!
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Most excellent - thank you very much!!

The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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