+ Reply to Thread
Results 1 to 9 of 9

Incorrect Serial Number Returned for YEAR Function

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    LA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Incorrect Serial Number Returned for YEAR Function

    Hello,

    I exported data from a database, and I'm trying to convert a date, 05/03/2011 into a column with the YEAR, which should read 2011. I have inserted a column, converted the date to a customer YYYY field, performed a copy and paste special with values only, but it returns the full date, not just the year. I have also tried the year function, =YEAR(ref cell); 05/03/2011 is reuturning 1905. I'm trying to have a simple 2011 returned so I can run the data in a pivot table. Happy to go about this a different way.

    Any help would be greatly appreciated.

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

    Re: Incorrect Serial Number Returned for YEAR Function

    have you tried to just simply format the data as year only, so that only year year shows? the cell contents will still contain the full date, but will only show the year (or am i missing your question?)
    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 Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Incorrect Serial Number Returned for YEAR Function

    Hi greenmat and welcome to the forum.

    This feels like a Apple vs PC date difference. Read http://support.microsoft.com/kb/180162
    Did the file come from a Mac? They keep dates differently.

    To get farther we need a sample workbook showing the problem. My guess is the number isn't a real date but need the example to confirm.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    07-26-2012
    Location
    LA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Incorrect Serial Number Returned for YEAR Function

    Hello FDibbins and Marvin,

    The pivot table requires a year date, not just formatting or it will list each date entry separately. My tricks listed above usually do the trick.

    I exported the data from a website, so it may be in text or cvs format, and not being ready as a numeral (at least that is my guess).

    Here are some sample entries ("sales date" is the actual data; "sale year" is formatting to YYYY; "sale yr 1" is the function =YEAR(ref cell)),

    Sale Date Sale Year Sale Yr 1
    5/3/2011 2011 1905
    7/18/2011 2011 1905
    5/3/2011 2011 1905
    4/21/2011 2011 1905
    4/24/2012 2012 1905

    I can send a worksheet, I just need a little guidance on this....sorry I'm new here.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Incorrect Serial Number Returned for YEAR Function

    To attach a sample workbook, click on the "Go Advanced" below the message area. Then on the Paper Clip Icon above the advanced message area and go from there.

  6. #6
    Registered User
    Join Date
    07-26-2012
    Location
    LA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Incorrect Serial Number Returned for YEAR Function

    Thanks for the help!
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Incorrect Serial Number Returned for YEAR Function

    Change the column C format to general or Number. It is currently formatted as yyyy
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  8. #8
    Registered User
    Join Date
    07-26-2012
    Location
    LA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Incorrect Serial Number Returned for YEAR Function

    Thanks!

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Incorrect Serial Number Returned for YEAR Function

    @ greenmat

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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