DATECALC() – Adds or subtracts days from a date
The DATECALC() function calculates a new date by adding or subtracting a specified number of days from an initial date. The format of the resulting date is determined by your MathGrid date settings.
Syntax
DATECALC(date, days)
- date: The starting date. This can be a text string (e.g., "01/01/2025", matching your MathGrid date settings), a cell reference containing a date, or the result of another date function like TODAY().
- days: The number of days to add to the date. Use a positive value to get a future date and a negative value to get a past date. This can be a number or a cell reference to a number.
Basic example
DATECALC(T1A1, T1B1)
Calculates a new date by adding the number of days in cell T1B1 to the date in cell T1A1.
Example outputs (assuming "dd/mm/yyyy" date format):
- If T1A1 = "01/01/2025" and T1B1 = 7: DATECALC(T1A1, T1B1) → "08/01/2025"
- If T1A1 = "15/03/2024" and T1B1 = -5: DATECALC(T1A1, T1B1) → "10/03/2024"
- Using TODAY() (assuming today is "20/07/2024") and days = 10: DATECALC(TODAY(), 10) → "30/07/2024"
- Using text date directly: DATECALC("10/02/2023", -100) → "02/11/2022"
Key features
- Date manipulation: Allows for easy calculation of future or past dates.
- Positive/Negative days: Adds days if the days argument is positive, subtracts if negative.
- Format-dependent output: The resulting date is formatted according to the global "Date Format Settings" in MathGrid.
- Handles month/year rollovers: Correctly calculates dates across month and year boundaries (e.g., adding 5 days to "28/02/2025" will result in "05/03/2025" if it's not a leap year).
Practical uses
- Calculating project deadlines: DATECALC(project_start_date, duration_in_days).
- Determining follow-up dates: DATECALC(TODAY(), 14) for a follow-up in two weeks.
- Finding expiration dates: DATECALC(purchase_date, warranty_period_days).
- Scheduling recurring events by repeatedly adding an interval to a base date.
Common mistakes
- Incorrect date format for 'date': If providing the initial date as text, it must match the format in MathGrid's settings.
- Non-numeric 'days' argument: The days argument must be a number. Text values (e.g., "seven") will cause an error.
- Using non-date value for 'date': The first argument must be a valid date or lead to one.
- Forgetting negative for past dates: To calculate a date in the past, ensure the days argument is a negative number.
MathGrid ©
MathGrid ©