+ Reply to Thread
Results 1 to 4 of 4

IF(date = 2007)

  1. #1
    Forum Contributor
    Join Date
    10-03-2005
    Posts
    183

    IF(date = 2007)

    Hi,

    I need to make a formula which can take a date formatted cell 01/01/2007, and take only the 2007 and compare that to a cell with general format with the txt 2007.

    If I use =RIGHT(A1;4) i get the date serial rather than the year... how can I pull out only the 4 digit year..?
    Last edited by Ctech; 03-05-2009 at 08:55 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: IF(date = 2007)

    Take CUSTOM format for a cell and put yyyy

    Like this: 1.JPG

    You don't need to cut date.. He'll take only year from whole date

  3. #3
    Forum Contributor
    Join Date
    10-03-2005
    Posts
    183

    Re: IF(date = 2007)

    I know this.. it is my fault.. I'm explaining my issue poorly

    Let say I have two cells

    A1 = 2007
    A2 = 01/01/07 but custom format yyyy = displayed as 2007

    However what if I want to use VLOOKUP(A2;A1;0;FALSE)

    Now VLOOKUP will not recognise that A1 is the same as A2.

    I therefore need to implement function x in my formula so that either A1 or A2 is formatted to the same format. So they are seen as the same value in Excel .

    I hope this makes it clearer.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: IF(date = 2007)

    Oh, I see... Then put YEAR(A32) in lookup value.. but in table array must be 2007

    =VLOOKUP(YEAR(A2);A1;0;FALSE) where A1 must be 2007, and A2 can be date
    Last edited by zbor; 03-05-2009 at 08:43 AM.

+ 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