+ Reply to Thread
Results 1 to 3 of 3

Incrementing dates in yymmdd format based on days of week

  1. #1
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    Incrementing dates in yymmdd format based on days of week

    For reasons that are far too complex to explain but suffice to say that the input can't be changed I have a spreadsheet that has a column of dates in yymmddd format with no separator so 160525 for example.

    Each date needs to be incremented in the next column by different criteria, sometimes it will be just to be the same day of each month, other times it will need to be say the Friday of every week.

    Taking the first row to begin with this has the date 160623 in Cell C2 and I need to increment this so that subsequent cells show the 23rd of every month.

    So at the moment I've broken down the date in cells E2, F2, G2 to show yy mm dd respectively. I've set the format of these fields to custom 00 in order to preserve the leading 0 for months and days that is needed.

    In H2 I've then got this formula: =TEXT(E2,"00")&TEXT(F2+1,"00")&TEXT(G2,"00") Whilst that works once we get to January the date is going to show as 161323 when it should be 170123. I can't work out how to amend this formula to cope with that and preserve the leading 0's where applicable.

    Jumping the gun a bit but in subsequent rows I need to change the date from say 160527 to be the Friday of every week thereafter. How can I write a formula to do that when that would require the date to be in a standard date format to begin with and then it needs converting back into a non standard date format??? Head spinning.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Incrementing dates in yymmdd format based on days of week

    It's probably best to convert to proper dates using this:

    =DATE(2000+left(C2,2),MID(C2,3,2),RIGHT(C2,2))

    Then it will be a lot easier to do the other manipulations that you mention. You can convert back to your format using this:

    =TEXT(date_cell,"YYMMDD")

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    Re: Incrementing dates in yymmdd format based on days of week

    Quote Originally Posted by Pete_UK View Post
    It's probably best to convert to proper dates using this:

    =DATE(2000+left(C2,2),MID(C2,3,2),RIGHT(C2,2))

    Then it will be a lot easier to do the other manipulations that you mention. You can convert back to your format using this:

    =TEXT(date_cell,"YYMMDD")

    Hope this helps.

    Pete
    Ahh yes I can certainly see how this would be easier. Thank you, I didn't know you could do that. I'll give that a try.

+ 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. Dates and days of the week...
    By shhhhh22 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-16-2016, 06:52 PM
  2. [SOLVED] Conditionally format cell based on dates within a number of days apart
    By mjy58 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-24-2013, 06:01 PM
  3. Plotting chart based on dates but extracting days of week only
    By pelachrum in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 05-21-2013, 11:03 AM
  4. [SOLVED] Calculating a week of dates/days based on the beginning date entered...
    By tiffany04530 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 11-27-2012, 09:55 AM
  5. Determine future dates based on selected days of the week
    By hnowack in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2008, 09:51 PM
  6. Filling columns with Dates (Incrementing by a Week)
    By tariq in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2007, 06:18 PM
  7. Sorting Dates in Days of the Week
    By Eagle784 in forum Excel General
    Replies: 3
    Last Post: 08-19-2005, 01:05 PM

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