+ Reply to Thread
Results 1 to 5 of 5

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

    =IF(E5="",YEAR(H5),YEAR(E5))
    The problem is that when text is entred into one of the cells the formula shows as #VALUE!.

    Is there a way of stopping this?

    Regards,
    Last edited by snoopy1461; 12-22-2011 at 11:00 AM. Reason: Solved

  2. #2
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,403

    Re: Formulas looking at the year in a date field

    Hi Snoopy,

    Use the following formula:-

    =IF(OR(E5="",ISTEXT(E5)),YEAR(H5),YEAR(E5))
    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  3. #3
    Valued Forum Contributor Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens Greece
    MS-Off Ver
    Excel 2003
    Posts
    2,297

    Re: Formulas looking at the year in a date field

    Hi snoopy

    You mean that sometimes you need to type in this cells, or that the user makes wrong type?


    In these cells(E5 & H5) you need to have only DAte data??
    Regards

    Fotis.

    I am proud that i am Greek.

    Just to know every one.We Greeks, we are nοt proud of our politicians. Υou?

    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.


    My Avadar picture, is from Athens Acropolis.
    http://www.theacropolismuseum.gr

    http://www.visitgreece.gr/

  4. #4
    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 dilipandey, this is just want i needed,

    Fotis1991, what i was looking for was to not only type in a date and for the formula to read it, but have text to be able to write in the cell and for the formula to ignore it. Dilipandey has solved this problem with his formula. Thanks for replying to my post though.

    Thanks again for your help

  5. #5
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,403

    Re: Formulas looking at the year in a date field

    You are welcome Snoopy....
    Cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

+ 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