+ Reply to Thread
Results 1 to 7 of 7

Show months in range

  1. #1
    Registered User
    Join Date
    11-12-2007
    Location
    Dordrecht, Netherlands
    MS-Off Ver
    2016
    Posts
    35

    Show months in range

    I have a formula that will checks and shows the months within a certain range. However when I look at the second month (cell C3), it return 28 instead of 8.

    I've tried it all from converting the date to the format of the cell, but it seems not to work . Any tips?
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Show months in range

    Why would you expect 8, when the month number is 9?
    a simple =month(cell-ref) should work.

    If that is not the case, please explain what you are doing.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-12-2007
    Location
    Dordrecht, Netherlands
    MS-Off Ver
    2016
    Posts
    35

    Re: Show months in range

    I would expect 8 because it should show 7, 8 and 9 (all months between the 2 dates). And the 3rd cell (c4) should then show 9.

    If the last date is e.g. 1-12-2018, it should show 7, 8, 9, 10, 11 and 12 below each other (if the formula was copied further)

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Show months in range

    Can you show what you expect, in your file please.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Show months in range

    You cannot use EDATE with cell C2, which just contains a number. Try this in C3:

    =IFERROR(MONTH(IF(EDATE(A2,1)>A3,"",(EDATE(A2,1)))),"")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    11-12-2007
    Location
    Dordrecht, Netherlands
    MS-Off Ver
    2016
    Posts
    35

    Re: Show months in range

    Hi AliGW; that was exactly what I was looking for; thanks!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Show months in range

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Show Expiration within 6 months
    By ldurham in forum Excel General
    Replies: 9
    Last Post: 03-28-2016, 01:42 PM
  2. Show low and high expendin months
    By kuzna26 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-14-2015, 01:57 AM
  3. Replies: 2
    Last Post: 03-19-2014, 07:26 PM
  4. SUMIFS with lint for only the last 6 months to show
    By Jp4Real in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-29-2013, 06:22 PM
  5. [SOLVED] Formula to show difference in months
    By jlax34 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2013, 12:37 PM
  6. show last 12 months
    By mdsickler in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2011, 07:06 PM
  7. Show months in Next Cell.
    By slashdot in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 08-26-2011, 03:22 AM

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