+ Reply to Thread
Results 1 to 7 of 7

Show Month as "99/99/0000" based on Year

  1. #1
    Forum Contributor
    Join Date
    11-03-2014
    Location
    Belgrade
    MS-Off Ver
    2010
    Posts
    348

    Question Show Month as "99/99/0000" based on Year

    Hi again

    This is an example:

    Year | Month
    2014 | Jan
    2014 | Jan
    2015 | Feb
    2016 | Mart
    2014 | Feb

    So in Column "Month" I need to switch the Month like

    Year | Mont
    2014 | 1/1/2014
    2014 | 1/1/2014
    2015 | 2/1/2015
    2016 | 3/1/2016
    2014 | 2/1/2014

    Can someone help me? :-D

    Thanks.

  2. #2
    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,969

    Re: Show Month as "99/99/0000" based on Year

    Is this access or excel?
    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

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,033

    Re: Show Month as "99/99/0000" based on Year

    Assume your field names are dYear for the Year column, dMonth for the month column then in a query to create the dates you wish

    PHP Code: 
    SELECT tbldates.dYeartbldates.dMonthDateSerial([dYear],Switch([dMonth]="Jan",1,[dMonth]="Feb",2,[dMonth]="Mar",3,[dMonth]="Apr",4,[dMonth]="May",5,[dMonth]="Jun",6,[dMonth]="Jul",7,[dMonth]="Aug",8,[dMonth]="Sep",9,[dMonth]="Oct",10,[dMonth]="Nov",11,[dMonth]="Dec",12),1) AS sMonth
    FROM tbldates

    This will put the dates in a new field called sMonth. You can then hide your field dMonth by unchecking the display check box in your QBE.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Contributor
    Join Date
    11-03-2014
    Location
    Belgrade
    MS-Off Ver
    2010
    Posts
    348

    Re: Show Month as "99/99/0000" based on Year

    Quote Originally Posted by FDibbins View Post
    Is this access or excel?
    This is Access

  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,969

    Re: Show Month as "99/99/0000" based on Year

    OK thanks

  6. #6
    Forum Contributor
    Join Date
    11-03-2014
    Location
    Belgrade
    MS-Off Ver
    2010
    Posts
    348

    Re: Show Month as "99/99/0000" based on Year

    Quote Originally Posted by alansidman View Post
    Assume your field names are dYear for the Year column, dMonth for the month column then in a query to create the dates you wish

    PHP Code: 
    SELECT tbldates.dYeartbldates.dMonthDateSerial([dYear],Switch([dMonth]="Jan",1,[dMonth]="Feb",2,[dMonth]="Mar",3,[dMonth]="Apr",4,[dMonth]="May",5,[dMonth]="Jun",6,[dMonth]="Jul",7,[dMonth]="Aug",8,[dMonth]="Sep",9,[dMonth]="Oct",10,[dMonth]="Nov",11,[dMonth]="Dec",12),1) AS sMonth
    FROM tbldates

    This will put the dates in a new field called sMonth. You can then hide your field dMonth by unchecking the display check box in your QBE.
    This works perfectly!
    Thank you!

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,033

    Re: Show Month as "99/99/0000" based on Year

    Thanks for the rep and happy to hear it solves your issue.

+ 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. Getting error trying to "group" by Day, Month and Year on a pivot table
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-03-2015, 05:14 PM
  2. Replies: 1
    Last Post: 03-23-2015, 06:19 PM
  3. Replies: 1
    Last Post: 06-05-2014, 09:48 AM
  4. Date/Month/Year formatting for column "c" not working for me...
    By Rabbitstew in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-02-2013, 10:37 PM
  5. [SOLVED] making a "if" function that uses only the month/year values from a date
    By ATraveller in forum Excel General
    Replies: 6
    Last Post: 10-02-2012, 03:43 AM
  6. Replies: 3
    Last Post: 05-01-2007, 12:03 PM
  7. Working out age from "Day" "Month" "Year"
    By timmyc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2006, 11:07 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