Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Blue Springs, Missouri, USA
    Posts
    108
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Function for # of days in month (XL97)

    Anyone have a function that will return the number of days in a month? I want to put a date in a cell (i.e. 01/01/2002) and then have a function in another cell that looks at that date and returns the number of days in that month.
    Thanks

    Dennis

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Function for # of days in month (XL97)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Dennis

    Try this for size: <font color=red> =DAY(DATE(YEAR(TODAY()),A1,0)) </font color=red>

    In cell A1 type 2 you will get 31 for January
    In cell A1 type 3 you will get 28 for February
    In cell A1 type 4 you will get 31 for March

    You see this formula gets the day of the serial number made up from today's year, wit the Month coming from a cell value A1 in this case, and the day set to zero which would mean the last day of the previous month, that is why you have to start with 2 ( I think <img src=/S/shy.gif border=0 alt=shy width=15 height=15> )

    Play with it and make it work to suite your needs, and if you need any help just reply to this message.

    Wassim <img src=/S/compute.gif border=0 alt=compute width=40 height=20>
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Function for # of days in month (XL97)

    Dennis

    Try this one as well <font color=red> =DAY(DATE(YEAR(E1),MONTH(E1)+1,DAY(E1)-DAY(E1))) </font color=red>

    This works with days as well.

    HTH

    Wassim <img src=/S/compute.gif border=0 alt=compute width=40 height=20>
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Function for # of days in month (XL97)

    If the date is in A1, then the following formula will give the number of days in the month.

    <pre>=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))
    </pre>

    Legare Coleman

Posting Permissions

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