You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

📰 Apple Fitness+ unveils an exciting lineup of new ways to stay active and mindful in 2025

Offerings include new programs for strength, pickleball, yoga, and breath meditation, and a new collaboration with Strava. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to calculate (cell reference - DD/MM/YYYY) inside formula?

I want to calculate a duration in years by entering a time duration formula in which the start date is a cell reference (the easy part) and the end date is a date I enter manually eg 17/7/2023 (I'm in Europe). I think I need the DATEDIF function, but it always converts 17/7/2023 into 17÷7÷2023 when I want to enter that as a date rather than having a separate column and then using the cell reference.


I thought to use the DATE function inside the DATEDIF function but either I am not getting the syntax right, or that isn't something that is possible.


How can I fix this please?

iMac2 (2)

Posted on Jul 27, 2023 11:06 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 27, 2023 7:21 PM

The DATE function will work in the DATEDIF function but you need to get your () and " right.


If the start date is in A2, then you can do this:


=DATEDIF(A2,DATE(2023,7,17),"M")


Use ; instead of , in the formula if your region uses , as the decimal separator.


SG

7 replies

Jul 27, 2023 6:03 PM in response to Basilisk2

Use Badunit's answer, but read up on DATE function

DATE - Apple Support


It always takes Year, month and Day as arguments, thus it doesn't matter your computer regional date settings, it will always work.


It also allows you to use some tricks like finding the last day of a month by using the next month and 0 for the day portion.

=date(2023,3,0) will give you last day of February.


Jason

Aug 7, 2023 11:46 AM in response to Basilisk2

Basilisk2, a few pointers to reduce your frustration.


1- The only way Numbers converts 17/7/2023 into 17÷7÷2023 as you said first, is because you typed =17/7/2023 in the cell. It's a simple value, do not use =.


2- Are you sure Numbers expects you to enter dates in the DD/MM/YYYY format? In my locale I have to use YYYY/MM/DD. You can check the expected format in File / Advanced / Language and region. If you enter the date components in an order that doesn't make sense for your local format, Numbers is not going to understand that 2023 is a year and not a day. By entering components in the correct order you can actually skip the century, thus 23 is automatically converted to 2023 and shown accordingly with the proper date format. / and - can both be used as separator.



3- To embed a function into another one, you can just select it when you're highlighting the appropriate argument of the first one.

First insert function DATEDIF from the function selector in the panel (if you don't see it click on Format in the toolbar).

Then when end-date is highlighted (dark grey), insert function DATE from the panel, and boom, all parentheses place themselves correctly.

Jul 27, 2023 6:10 PM in response to jaxjason

I can use the DATE function, but I cannot insert it into the DATEDIF function. That is my problem. I am trying to nest functions which is easy when coding, but I can't get it to work in Numbers.


This latest version of Numbers has changed a lot and I am having trouble reading the text and where the function parentheses are, there is so much useless light grey on white. I miss the yellow flashes when you close a set of parentheses, and the text in the bottom margin outside the sheet is impossibly small and cannot be enlarged. Sorry, you don't need to hear that! It's been a very frustrating day... because of Numbers.

How to calculate (cell reference - DD/MM/YYYY) inside formula?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.