Consulting

Results 1 to 9 of 9

Thread: IF STATEMENT TO extract result

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location

    Exclamation IF STATEMENT TO extract result

    hi

    i was trying to enter a date in an excel cell and then write an if statement in another cell to return what month the date was for. i tried the following statement.

    =IF(A1="MM/DD/YYYY","DD","") the formula returned false.

    i enter the following date in cell A1 6/13/2008

    if the cell doesnt contain a date it should remain blank. if it does return the month it is.

    is it possible to have the result show as the spelling of the month instead of the number

    i.e if its the 6th month in the date the formula would return June.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =IF(A1="","",MONTH(A1))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    thank you i have never seen this kind of if statement before. is there a way to have it say june instead of 6?

  4. #4
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    228
    Location
    Quote Originally Posted by josephm
    thank you i have never seen this kind of if statement before. is there a way to have it say june instead of 6?
    You can select the individual cell(s), Column or Row containing the data and go to Format Cells, Custom, and type in mmm

    This return the value as a 3 digit month (1=Jan,2=Feb, etc)

    Marshybid

  5. #5
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    228
    Location
    Quote Originally Posted by marshybid
    You can select the individual cell(s), Column or Row containing the data and go to Format Cells, Custom, and type in mmm

    This return the value as a 3 digit month (1=Jan,2=Feb, etc)

    Marshybid
    Another way of presenting the data in "mmm" format would be to modify the fromula from xld slightly to read

    =IF(A1=" "," ",TEXT(MONTH(A1),"mmm"))

    If you want the full month name (January, etc) just change it to "mmmm"

    This also works.

    Marshybid

  6. #6
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    Thank you very much.

    Question

    I have two sheets. Sheet1 & Sheet2.

    On Sheet1 you will enter a date in cell B4 and C4 (dd/mm/yyyy)

    On Sheet two cell C6 must check B4 and C4 for dates and become filled with grey.

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    conditional form atting with a formula of

    =AND(ISNUMBER(Sheet1!B4),ISNUMBER(Sheet1!C4))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location

    Exclamation

    OK. i dont understand.

    I have attached a work book with the problem.

    i have entered sample information for a name.

    the person wished to take their vacation form a date in week3 of january to a date in the second week in february.

    since its vacation they dont count in the weekends so, the sample dates entered equals 20 days between the two dates.

    so how to i get excel to shade E6:H6 which will represent the 20 days as 4 weeks.?

    i have manually shaded the cells in the table on sheet2 which represent the duration of the two dates entered from sheet1.

  9. #9
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    i tried to use conditional formating as suggested and it gave me a warning saying that i cannot reference different sheets

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •