ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find multiple or by different words (https://www.excelbanter.com/excel-programming/415376-find-multiple-different-words.html)

Lucas

find multiple or by different words
 
Hello,

I would like to us the find function on a sheet to search for either of 2
words.
If I want to search for multiple words for example A and B I use:

..Find(what:="A" & "*" & "B",

But what do I use if i want to search for A OR B.
I know I can first search for A and subsequently for B but I would like to
use a single find function.

thanks in advance!
Lucas van Rijsewijk
Deurne, The Netherlands

Per Jessen

find multiple or by different words
 
Hello Lucas

I don't think you can search for two strings at once.

Maybe this will help you.

Set found = Columns("A").Find(what:="A")
If found Is Nothing Then
Set found = Columns("A").Find(what:="B")
End If

Regards,
Per
Copenhagen, Denmark
"Lucas" skrev i meddelelsen
...
Hello,

I would like to us the find function on a sheet to search for either of 2
words.
If I want to search for multiple words for example A and B I use:

.Find(what:="A" & "*" & "B",

But what do I use if i want to search for A OR B.
I know I can first search for A and subsequently for B but I would like to
use a single find function.

thanks in advance!
Lucas van Rijsewijk
Deurne, The Netherlands



Lucas

find multiple or by different words
 
Thanks for your reply Per!
Using the Set function also avoids an error message if nothing is found.

Thanks for helping out this newbie!

Per Jessen

find multiple or by different words
 
Hi Lucas

Thanks for your reply. I'm glad to help.

Best regards,
Per

"Lucas" skrev i meddelelsen
...
Thanks for your reply Per!
Using the Set function also avoids an error message if nothing is found.

Thanks for helping out this newbie!




All times are GMT +1. The time now is 11:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com