Hi all,
I would like an if function which would check to see if a string of numbers has any of the same characters as a variable.
I.e. if my variable is 35, I'd like the if function to be true if the cell contains either 3 or 5.
Thanks
Hi all,
I would like an if function which would check to see if a string of numbers has any of the same characters as a variable.
I.e. if my variable is 35, I'd like the if function to be true if the cell contains either 3 or 5.
Thanks
If your cells just contain 3 or 5
=ISNUMBER(SEARCH(a1,a2,1))
=ISNUMBER(SEARCH(cell with 3 or 5,cell with 35,1))
Please Login or Register to view this content.
Tested using S = abcd3hgg, V = 35.
This will support any length of string or variable.
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
Here is a UDF (user defined function) that will do what you asked for...
Please Login or Register to view this content.
I just thought of a way to make the function you want without using any loops...
Note: This function assumes the first argument is a number composed of all digits only.Please Login or Register to view this content.
Last edited by Rick Rothstein; 09-17-2020 at 11:33 AM.
You would use any of the posted functions the same way you would use a built-in function... pass the arguments into it and do something with the result. For example...
If NumInNum(123456, 35) Then
....
End If
or...
MsgBox NumInNum(123456, 35)
or...
SomeBooleanVariable = NumInNum(123456, 35)
Save the function in a Macro Module.
Type something like abcde4h3fgg in A1
Type =VarF(A1, 235) in any other cell.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks