Anoop
Anoop

Reputation: 5376

Sharepoint Calculated column formula for date-time comparison

I have two columns C1 and C2, both of type date and time in a document library. Now i want to create a calculated column C3 using which i could know which column(C1 or C2) is having greater value. I tried following formula for calculated column IF(C1>C2, 1,0) it works perfectly fine, but if i replace C1 with 'Modified' column it doesnt seem to work. Please use different datetime values for C2 to get 1,0,1,0 in calculated column. I noticed that after 2-3 operations it remains either 1 or 0.

Upvotes: 1

Views: 12446

Answers (1)

Temple
Temple

Reputation: 1079

Update I've just tested this as follows:

Create List with 3 columns:

C1 - Date and Time    
C2 - Date and Time    
C3 - Calculated Column.

I configured the Calculated Column to return a Number and entered the following formula in:

=IF(c1>c2,1,0)

This worked perfectly.

If the Calculated Column should return Text (the default setting) then using the following formula worked:

=IF(c1>c2,"1","0")

Once again, this works perfectly for me.

Upvotes: 1

Related Questions