+ Reply to Thread
Results 1 to 5 of 5

Subtracting two dates

  1. #1
    Forum Contributor
    Join Date
    10-26-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2010
    Posts
    138

    Subtracting two dates

    How will i format 31.12.13 to date of dd/mm/yy.

    I can't subtract 31/04/14 from 30/03/14 or 31.04.14 from 30/03/14.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Subtracting two dates

    Send a file to analyze what you want.

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Subtracting two dates

    If G6 contains the date (text) "31.12.13" you can convert it using the following formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    04-27-2015
    Location
    Abu Dhabi, U.A.E
    MS-Off Ver
    Office 365 | 2016
    Posts
    696

    Re: Subtracting two dates

    Formatting option is shown in the attached sheet.

    Assume that the date (which excel not treat as date) is in A2.
    Formula: =DATE(2013,MID(A2,4,2),LEFT(A2,2))

    13 is will consider as 1913 while doing the Right option in date Function, so better to right it manually in the formula.

    Regards
    Shareez
    Attached Files Attached Files

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Subtracting two dates

    Quote Originally Posted by jewellove View Post
    How will i format 31.12.13 to date of dd/mm/yy.
    quick answer, you cannot. That is a text entry, not a date, you need to 1st convert it to a real date using a formula or function. Then you can format it as needed

    I can't subtract 31/04/14 from 30/03/14 or 31.04.14 from 30/03/14.
    Again, because those are text and not real dates, you cannot to any math on them until they are converted to dates.

    What you need to understand about dates and times in excel is that a date is just a number representing the number of days passed since 1/1/900...and then formated in a way that we recognise as a date. So, for instance, today (Thu Jun 2015) is actually 42159

    The suggested formulas should do what you need for the conversion, you should then be able to calc the difference from that
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Subtracting Dates
    By soma104 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2010, 01:31 AM
  2. Subtracting Dates
    By CoachBarker in forum Excel General
    Replies: 8
    Last Post: 04-13-2009, 01:16 PM
  3. [SOLVED] Subtracting Dates
    By sam in forum Excel General
    Replies: 3
    Last Post: 03-02-2006, 08:50 AM
  4. Subtracting dates?
    By Bill R in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  5. [SOLVED] Subtracting dates?
    By Bill R in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1