Skip to main content
Solved

How to subtract a number from a date

  • May 19, 2019 7:14 PM UTC
  • 10 replies
  • 156 views

hey, whats the formula to subtract a week from a field with a date?

thanks alot!

Best answer by Jeremy_Oglesby

DATEADD({Date Field}, -1, 'week')
View original
This topic has been closed for replies.

10 replies

Forum|alt.badge.img+18
DATEADD({Date Field}, -1, 'week')

  • Participating Frequently
  • Nov 13, 2019 4:24 PM UTC
DATEADD({Date Field}, -1, 'week')

I’m trying to do something similar, but got an error…

Here’s the formula :
DATEADD({Shipping Date}, -{Days to maturity}, ‘day’)

Shipping Date is the date of shipping the crop order.
The Days to maturity is a lookup field from another table describing my crops.
I want to know my planting date by subtracting the number of days to maturity from the order date.

The formula return an error. Please can you tell me what I am doing wrong ?
Thanks alot !
Phil


Forum|alt.badge.img+18

I’m trying to do something similar, but got an error…

Here’s the formula :
DATEADD({Shipping Date}, -{Days to maturity}, ‘day’)

Shipping Date is the date of shipping the crop order.
The Days to maturity is a lookup field from another table describing my crops.
I want to know my planting date by subtracting the number of days to maturity from the order date.

The formula return an error. Please can you tell me what I am doing wrong ?
Thanks alot !
Phil


Just curious… if you remove the “-“ that’s before your second field name, does that at least solve the problem of the formula throwing an error?


  • Participating Frequently
  • Nov 13, 2019 6:21 PM UTC

Just curious… if you remove the “-“ that’s before your second field name, does that at least solve the problem of the formula throwing an error?


Nope, no error, just give me the same date as in Shipping date…


Forum|alt.badge.img+18

Nope, no error, just give me the same date as in Shipping date…


Is {Days to Maturity} a number field? Formula field?


  • Participating Frequently
  • Nov 13, 2019 6:24 PM UTC

Is {Days to Maturity} a number field? Formula field?


It’s a lookup field from another table. In it’s table it is an integer.


Forum|alt.badge.img+18

It’s a lookup field from another table. In it’s table it is an integer.


Try this:

DATEADD(
   {Shipping Date},
   0 - VALUE({Days to maturity}),
   'day'
)

  • Participating Frequently
  • Nov 13, 2019 6:29 PM UTC

Try this:

DATEADD(
   {Shipping Date},
   0 - VALUE({Days to maturity}),
   'day'
)

It produces an error.


Forum|alt.badge.img+18

It produces an error.


Ok, remove the VALUE() portion:


  • Participating Frequently
  • Nov 14, 2019 3:56 AM UTC

Ok, remove the VALUE() portion:


Perfect! Thank you very much.