+ Reply to Thread
Results 1 to 4 of 4

Thread: Formulas looking at the year in a date field

  1. #1
    Registered User
    Join Date
    12-30-2010
    Location
    Huddersfield, England
    MS-Off Ver
    Excel 2003
    Posts
    50

    Question Formulas looking at the year in a date field

    I have a formula below that looks in cells E5 and H5 for the year in the date, if text is entered into one of the column's it come's back with an error. Is there something that can be done to stop this?

    =IF(E5="",YEAR(H5),YEAR(E5))
    Let me know if i need to give you more information!

    Regards,

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    986

    Re: Formulas looking at the year in a date field

    Try IFError Formula

    =IFError(IF(E5="",YEAR(H5),YEAR(E5)), "") This will give you blank if the result is an error.
    To thank someone who has helped you, click on the star icon below their name.

    I hate reading

    Portfolio

    I need a job.
    I am young and incompetent

  3. #3
    Registered User
    Join Date
    12-30-2010
    Location
    Huddersfield, England
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Formulas looking at the year in a date field

    Thanks for this, but i was hoping that the date of the other column that has a date in would still show?

  4. #4
    Forum Guru Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007
    Posts
    3,523

    Re: Formulas looking at the year in a date field

    if text is entered into one of the column's it come's back with an error. Is there something that can be done to stop this?
    You can use Data Validation in the date cells to enforce that entries are valid dates.
    See this page for Data Validation Examples at Contextures
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

+ 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.2.0