I am trying to develop a formula to determinate current days until the end of a campaign.

For that i have the following fields

  • Start Date
  • End Date
  • Days from Today to End Date

The code that i am implementing and its not working correctly is.

IF( Now()  >= EndDate , 0, EndDate -  TODAY())

So basically what i want to accomplish is. If today is equal to the end day of the campaign return 0 else return the remaining days.

  • You say it's not working correctly, but what exactly is it doing now? Jan 23 '15 at 9:16
  • keeping this number value EndDate - TODAY() Jan 23 '15 at 9:21
  • Do you mean it always shows the result of EndDate - TODAY()? Jan 23 '15 at 9:22
  • I think i kinda know the mistake. It gives false because its false :D What i want to accomplish is if Now is equal or bigger than End Date... I tried that at this moment but it gives error Error: Incorrect parameter type for operator '>'. Expected DateTime, received Date Jan 23 '15 at 9:23
  • I thought so too, please try the answer I added. :-) Jan 23 '15 at 9:25

Firstly, you should use TODAY() instead of NOW(). NOW() returns a datetime while TODAY() returns a date. This means you can't compare NOW() to EndDate.

Another problem is that it only shows 0 if the EndDate is exactly equal to TODAY(). This is only one day. You want to check whether EndDate is greater than TODAY():

IF( TODAY() > EndDate, 0, EndDate - TODAY() )

  • I still get this error: Error: Incorrect number of parameters for function 'DATE()'. Expected 3, received 0 Jan 23 '15 at 9:28
  • Woops, please try my changed answer :-) Jan 23 '15 at 9:29
  • Works like a charm. I rushed with my question It wasn't that hard at the end. Thanks @Koen Jan 23 '15 at 9:31

What you want is DATE() formula. Because NOW() returns a DateTime value. Comparing a DateTime with a Date will always return false. Try using DATE(NOW())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.