# if digit is 1 Or 4 Or 7 Or 0

I am trying the query below but it doesn't work. Can't remember how to do this.

something like this??
If intRDigit = In(1,4,7,0) Then

If intRDigit = 1 Or 4 Or 7 Or 0 Then
strtest = "A"
ElseIf intRDigit = 2 Or 5 Or 8 Then
strtest = "B"
Else
strtest = "C"
End If
cyberkiwi

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can also use this

``````If InStr(intRDigit, "1470") > 0 Then
strtest = "A"
ElseIf InStr(intRDigit, "258") > 0 Then
strtest = "B"
Else
strtest = "C"
End If``````
Or you could use Select Case -

SELECT CASE IntRDigit
Case 1,4,7,0
strtest = "A"
Case 2, 5, 8
strtest = "B"
Case Else
strtest = "C"
End Select
Or use SELECT CASE

``````Select Case intRDigit
Case 1, 4, 7, 0
strtest = "A"
Case 2, 5, 8
strtest = "B"
Case Else
strtest = "C"
End Select``````

brilliant. thank you for the choice :)

Shawn
One Line:

strtest = Choose(strtest + 1, "A", "A", "B", "C", "A", "B", "C", "A", "B")

mx
@Dbmx

This is both shorter, and correct, as long as intRDigit is >= 0
Your Choose options don't cover more than 0-8.

strtest = Left(Mid("AABCABCAB", intRDigit + 1, 1) + "C", 1)

i actually used the select case.
the digits are 0-9. the else covers 3, 6 and 9.

the actual strings are quite bit longer than strtest = "A".
"Your Choose options don't cover more than 0-8."
Either does your Accepted solution  - so what?

mx
> i actually used the select case.
So then why wasn't there at least a split?  I posted the select case option...
"Either does your Accepted solution  - so what?"
Never mind ... I see that it does.
" I posted the select case option..."
Exactly ... First at that ...

mx
Still one line ... covering any number > 8:

strtest = Nz(Choose(strtest + 1, "A", "A", "B", "C", "A", "B", "C", "A", "B"), "C")

mx