mikeds
mikeds

Reputation: 187

SharePoint list calculated column compare dates

I've got a field in a SharePoint list that multiplies a number of miles someone enters in one column with the current reimbursement rate for mileage.

It ends up like this: =[Mileage] * 0.51

With the rates now going up I need to increase that, but only for rates entered after a certain date. This should be ok because we capture the entry date. However, I can not get it to work.

Doing something like this: =IF([Date] < "7/1/2011", [Mileage] * 0.51, [Mileage] * 0.555)

Does not seem to work, as the first equation always triggers. I'm assuming I'm missing something simple like converting the string to a date, but can not find it after searching.

Upvotes: 1

Views: 4926

Answers (1)

Ryan
Ryan

Reputation: 24422

The SharePoint function you're looking for is DATE(year,month,day)

So this gives (assuming your orig date was US format so 1st July 2011)

=IF([Date] < Date(2011,7,1), [Mileage] * 0.51, [Mileage] * 0.555)

Self promotion - but this SharePoint Calculated Column Cheat Sheet may help you if you're doing lots of calculated column stuff.

Upvotes: 3

Related Questions