mercredi 2 janvier 2019

Conditional if statement function best method?

I am thinking of what the best method would be in this scenario. I am trying to look at 4 columns all being timestamps.

Col_A Col_B Col_A1 Col_B1 Timestamp Timestamp Timestamp Timestamp

I am looking for the best way in which I can create a if statement within a function that looks for the earlier time between Col_A and Col_B and then which ever col is earlier I want to find the earlier value within Col_A1 and Col_B1.

for example if the timestamp in Col_A is earlier than the timestamp in Col_B I want to see if the timestamp for Col_A1 is earlier than Col_B1 then I want a new column that says 1.

Basically I am trying to see if the earlier timestamp in the first two columns corresponding timestamp in the last two columns is earlier or later.

so something like if A < B and A_1 < B_1 then 1 and if A < B but A_1>B_1 then 2. So whatever the earlier timestamp is in the first two columns - I want to see if that col timestamp was earlier in the second two columns.

Aucun commentaire:

Enregistrer un commentaire