+ Reply to Thread
Results 1 to 5 of 5

Subtract one day from date

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Subtract one day from date

    Hi, I am trying to subtract one day from the date in column A1. The dates in A1 were formatted as General (no specific number format) so I attempted to reformat them as a date(mm/dd/yyyy). I keep getting runtime error 13: type mismatch though.

    Here is my code:

    Please Login or Register  to view this content.
    Any ideas?
    Last edited by karlkr245; 03-09-2011 at 03:10 PM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Subtract one day from date

    Dates in Excel are really numbers, so you could try just subtracting 1 from the value.
    Please Login or Register  to view this content.
    The numberformat won't make any difference.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    03-02-2011
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Subtract one day from date

    Hello Colin I am still getting the runtime error 13 after trying that, also tried removing the numberformat and it still runtime errored. The dates in the column follow the format as 01/21/2011.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Subtract one day from date

    It sounds like the dates are strings rather than numbers.

    Before you run the code:
    • Select the column containing the dates
    • Data > Text To Columns
    • Next
    • Next
    • In the column data format choose Date MDY
    • Finish
    This should convert them into dates for you.

  5. #5
    Registered User
    Join Date
    03-02-2011
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Re: Subtract one day from date

    Thanks! It is working now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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