PDA

View Full Version : [SOLVED] How to set formula equal to a series of numbers



clif
10-17-2017, 12:57 AM
Dear all,

How to set formula equal to a series of numbers.

If cells(1,1) = {1,3,5,7,9} Then

Else

EndIf

Thanks!

Bob Phillips
10-17-2017, 02:32 AM
Are you saying that A1 contains a comma delimited list of numbers, or they are spread across adjacent cells?

mancubus
10-17-2017, 02:34 AM
i understand 'if' the cell's value is in a predefined list of values...



Sub vbax_61038_check_if_cell_value_in_list()

Dim i As Long
Dim MyList

MyList = Array(1, 3, 5, 7, 9)

'this:
If Not IsError(Application.Match(Cells(1, 1).Value, MyList, 0)) Then
Else
End If

'or this
If UBound(Filter(MyList, Cells(1, 1).Value)) > -1 Then
Else
End If

'or any other method. for ex, a loop

End Sub