I need to write an if statement based on some conditions which MUST be true and then other conditions of which any "4" (the value 4 needs to be an input by the user) can be true.
However, I need the user to be able to determine which conditions are "MUST" conditions. I will have the user indicate whether a condition is a "MUST" have with a list box which will then put a "1" in a cell against that condition indicating it is a "MUST" condition. There are 8 conditions of which any can be "MUST" and the rest are other.
Example:
Sub condition_analysis()Dim data_set As Variant
data_set = Range("A4:AN7500")
Dim i As Long
For i = 1 To UBound (data_set, 1)
factor_1 = data_set(i, 10)
factor_2 = data_set(i, 9)
factor_3 = data_set(i, 8)
If factor_1 > 0 Then
factor_1 = 1
End If
If factor_2 > 0 Then
factor_2 = 1
End If
If factor_3 > 0 Then
factor_3 = 1
End If
If factor_1 = 1 And (factor_2 + factor_3 + factor_4) > 1 Then 'Here is my problem - in this example factor_1 is a "MUST" condition while the others are not. But I need which conditions are MUST conditions (and their associated positioning in the code) to be determined by the user (cell values based on list box); how do I do this?
condition_satisfied = True
End If 'I then go on to do calculations on other data based on whether the condition_satisfied is True or not
However, I need the user to be able to determine which conditions are "MUST" conditions. I will have the user indicate whether a condition is a "MUST" have with a list box which will then put a "1" in a cell against that condition indicating it is a "MUST" condition. There are 8 conditions of which any can be "MUST" and the rest are other.
Example:
Sub condition_analysis()Dim data_set As Variant
data_set = Range("A4:AN7500")
Dim i As Long
For i = 1 To UBound (data_set, 1)
factor_1 = data_set(i, 10)
factor_2 = data_set(i, 9)
factor_3 = data_set(i, 8)
If factor_1 > 0 Then
factor_1 = 1
End If
If factor_2 > 0 Then
factor_2 = 1
End If
If factor_3 > 0 Then
factor_3 = 1
End If
If factor_1 = 1 And (factor_2 + factor_3 + factor_4) > 1 Then 'Here is my problem - in this example factor_1 is a "MUST" condition while the others are not. But I need which conditions are MUST conditions (and their associated positioning in the code) to be determined by the user (cell values based on list box); how do I do this?
condition_satisfied = True
End If 'I then go on to do calculations on other data based on whether the condition_satisfied is True or not