Hello,

Does anyone know if I can compute a new variable in a new column using if statements - similar to that of statistical software?

For instance, if I have individual data in each row: if baseball = 1 and youth = 1 then columnC = 1 else columnC = 0

They way I managed to do it was not efficient for 40000 records in multiple data sets:


Dim LR As Long
LR = Range("S" & Rows.Count).End(xlUp).Row

For rownum = 1 To LR

If (Cells(rownum, Range("Baseball").Column) = 1) And Cells(rownum, Range("Youth").Column)= 1 Then
Cells(rownum, Range("columnC").Column) = 1
Else
Cells(rownum, Range("columnC").Column) = 0
End If


Next rownum


Thanks & Cheers!