+ Reply to Thread
Results 1 to 5 of 5

Combining Year, Month, and Day Columns into YYYYMMDD Format

  1. #1
    Forum Contributor
    Join Date
    04-01-2019
    Location
    USA Ohio, Fremont
    MS-Off Ver
    Office 365
    Posts
    138

    Combining Year, Month, and Day Columns into YYYYMMDD Format

    I am trying to do something that might be kind of simple, but I have not been able to do it.

    I am trying to combine three columns representing Year - Column F, Month - Column D, and Day of Month -Column E into a single column G. I want to be able to sort this column. I would like to see it formatted as YYYYMMDD, with a single digit months and days being preceded by a zero. It could also be formatted as YYYY-MM-DD with the same single digit formatting requested. The cell format can be date, number, or text which ever you recommend.

    I tried the formula in cell G2 =F2&D2&E2, but it did not give me a zero in front of the 2 for the month.

    I am attaching a worksheet which shows what I am trying to accomplish. I want to fill in the cells highlighted in
    yellow.

    Thanks for any recommendations which can give me the results I would like to achieve.

    I would like to have this column even if it is possible to sort Column A in date order, although I am not sure this is possible.
    Attached Files Attached Files

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

    Re: Combining Year, Month, and Day Columns into YYYYMMDD Format

    You can do this in G2 to include hyphens:

    =F2&"-"&TEXT(D2,"00")&"-"&TEXT(E2,"00")

    or if you don't want the hyphens you can do this:

    =F2&TEXT(D2,"00")&TEXT(E2,"00")

    The results are text values.

    If you want numbers then you can do this:

    =F2*10000 + D2*100 + E2

    and format the cell as General.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    04-01-2019
    Location
    USA Ohio, Fremont
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Combining Year, Month, and Day Columns into YYYYMMDD Format

    Thanks this gives me exactly what I want in either text or number format.

    I appreciate your help!

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

    Re: Combining Year, Month, and Day Columns into YYYYMMDD Format

    You're welcome - thanks for the rep.

    Pete

  5. #5
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,434

    Re: Combining Year, Month, and Day Columns into YYYYMMDD Format

    Power Query
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Combining columns with month day year
    By jasman922 in forum Excel General
    Replies: 1
    Last Post: 09-10-2022, 05:00 PM
  2. combining columns from month and year in a pivot table
    By shaner312 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-27-2021, 11:20 AM
  3. Convert YYYYMMDD to Month Year?
    By aju051000 in forum Excel General
    Replies: 3
    Last Post: 06-27-2018, 06:13 PM
  4. combining month, date and year into a single column
    By Yogarajah in forum Excel General
    Replies: 6
    Last Post: 08-05-2014, 03:18 AM
  5. Need a formula for this format YYYYMMDD-YYYYMMDD (20130801-20130831)
    By Infoway123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-24-2013, 02:25 PM
  6. day/month/year in incorrect format for date format
    By M&A_Jack in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] day/month/year in incorrect format for date format
    By M&A_Jack in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10: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