Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: How to calculate days in the month

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    I would like to find a function that can calculate the number of days in the month for a given date that is provided in the following format dd/mm/yy.

    For example 23/02/02, would result in 28.
    23/02/04, would result in 29.
    31/01/01, would result in 31.
    etc....

    Thanks in Advance,
    Sharon

  2. #2
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    84,026
    Post Thanks / Like
    Mentioned
    37 Post(s)
    Tagged
    7 Thread(s)

    Default

    On 2002-03-11 21:03, shanmer wrote:
    Hi,

    I would like to find a function that can calculate the number of days in the month for a given date that is provided in the following format dd/mm/yy.

    For example 23/02/02, would result in 28.
    23/02/04, would result in 29.
    31/01/01, would result in 31.
    etc....

    Thanks in Advance,
    Sharon
    Sharon,

    One way:

    =DAY(DATE(YEAR(A2),MONTH(A2)+1,0))

    where A2 house a date like the examples you provided.

    Aladin

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Looks like Alladin beat me to it just
    as I was about to post

    Just to add to that format the cell as
    general....

    Ivan

  4. #4
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-11 21:03, shanmer wrote:
    Hi,

    I would like to find a function that can calculate the number of days in the month for a given date that is provided in the following format dd/mm/yy.

    For example 23/02/02, would result in 28.
    23/02/04, would result in 29.
    31/01/01, would result in 31.
    etc....

    Thanks in Advance,
    Sharon
    If you have the Analysis ToolPpak add-in installed (Tools-Add-ins, Analysis ToolPak if you don't), you can use the following formula:

    =EDATE(A1,1)-A1

    This assumes your date is in A1.

    Hope this helps,

    Russell

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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