+ Reply to Thread
Results 1 to 8 of 8

Problems with YEAR formula and Dates

  1. #1
    Registered User
    Join Date
    06-09-2014
    Posts
    39

    Problems with YEAR formula and Dates

    I have in column A a series of dates, in long date format, MM/DD/YYYY. In column B I want just the year, so I used for B2; =YEAR(A2) expecting for 08/01/2013 to have 2013 returned. Instead I get #Value!

    I also tried having column A as general format. This did not work either. Could this have something to do with my administrators settings? As far as I have experienced what I am doing should work.

    I have attached an image of my file for clarification. excel.png

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problems with YEAR formula and Dates

    Most likely, your dates are stored as text. Assuming they are in a format compatable with your default date pattern (can't tell from the picture whether it's m/d/yr or d/m/yr or where you are from in your profile).

    A picture does not help us troubleshoot usually. To attach a spreadsheet, Go Advanced>Manage Attachments.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Problems with YEAR formula and Dates

    If you're getting a #VALUE! error that means your dates are not true Excel dates. They're probably TEXT strings that look like dates.

    What version of Excel are you using?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    06-09-2014
    Posts
    39

    Re: Problems with YEAR formula and Dates

    Valko - I am using version 2010.

    Chemist B - the format is m/d/yr

    I have attached a sample spreadsheet (I can't attach the actual file due to confidentiality issues).
    Attached Files Attached Files

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Problems with YEAR formula and Dates

    OK, your dates are really TEXT values.

    This worked in the sample file...

    Select the range of dates
    Goto the Data tab>Text to Columns
    Click: Finish

    Now you can format the dates in the desired style.

  6. #6
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,318

    Re: Problems with YEAR formula and Dates

    Or if you may not change the cells:
    =right(a1,4)
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  7. #7
    Registered User
    Join Date
    06-09-2014
    Posts
    39

    Re: Problems with YEAR formula and Dates

    Thanks so much everyone.

    I ended up using Popipipo's recommendation as changing the format of the cells to be an actual date still didn't yield what I wanted using the Year Function. I was getting an output of 1905 rather than the desired 2013.

    Cheers,

  8. #8
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,318

    Re: Problems with YEAR formula and Dates

    If you result is 1905 your celformat is 'date'
    Change it to 'number' and you get 2013

+ 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. [SOLVED] Require a formula to see if 2 dates fall within Year end and Start
    By john dalton in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-06-2014, 09:12 AM
  2. [SOLVED] Problems with formula calculating dates and count ifs
    By skalus in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-23-2013, 06:28 AM
  3. Need formula to change dates based on given year
    By kesmith2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-27-2013, 06:46 AM
  4. Replies: 3
    Last Post: 08-14-2012, 05:14 AM
  5. countif. dates in a year (year is the criteria)
    By barrfly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-18-2010, 03:33 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