+ Reply to Thread
Results 1 to 11 of 11

Excel Formula to calculate number of days

  1. #1
    Registered User
    Join Date
    10-14-2015
    Location
    NY, USA
    MS-Off Ver
    2007
    Posts
    46

    Excel Formula to calculate number of days

    I have two columns settlement date and maturity date. I am trying to calcukate the number of days interest is charged in a given month. For example if a security is settled on Jan 5th and maturing on February 10th, the number of days interest is charged in Jan is 26 days (1/5 to 1/31). I I have attached the file for example.
    Attached Files Attached Files
    Last edited by FDibbins; 02-03-2017 at 01:46 AM.

  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,917

    Re: need help coming up with a formula

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )
    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
    10-14-2015
    Location
    NY, USA
    MS-Off Ver
    2007
    Posts
    46

    Excel Formula to calculate number of days

    I have two columns settlement date and maturity date. I am trying to calcukate the number of days interest is charged in a given month. For example if a security is settled on Jan 5th and maturing on February 10th, the number of days interest is charged in Jan is 26 days (1/5 to 1/31). I I have attached the file for example.
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,396

    Re: need help coming up with a formula

    Hi ruchi1127,

    If I have interpreted correctly try this in C5 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A
    B
    C
    1
    Start Date
    1/1/2017
    2
    End Date
    1/31/2017
    3
    4
    Settle Date
    Maturity Date
    Number of Days of Interest Paid in January
    5
    10/13/2016
    1/3/2017
    2
    6
    10/3/2016
    1/4/2017
    3
    7
    1/4/2017
    2/3/2017
    28
    8
    1/4/2017
    2/10/2017
    28
    9
    1/31/2017
    4/28/2017
    1
    Dave

  5. #5
    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,917

    Re: need help coming up with a formula

    Thanks for the title change

    (you actually need to make the change in your very 1st post (post #1), so it carries through all the thread - I will do that for you now )

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,396

    Re: need help coming up with a formula

    Actually this formula would be simpler.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,412

    Re: need help coming up with a formula

    Quote Originally Posted by FlameRetired View Post
    Actually this formula would be simpler
    I afraid that both of yours fail if the settle and Maturity dates are out of the date condition range.
    i.e 4/2 and 28/2/2017

    My suggestion:

    =MAX(0,MIN(B5,$B$2)-MAX(A5,$B$1)+(B5>$B$2))
    Quang PT

  8. #8
    Registered User
    Join Date
    10-14-2015
    Location
    NY, USA
    MS-Off Ver
    2007
    Posts
    46

    Re: need help coming up with a formula

    Thank you! the formula worked well! appreciate it

  9. #9
    Registered User
    Join Date
    10-14-2015
    Location
    NY, USA
    MS-Off Ver
    2007
    Posts
    46

    Re: need help coming up with a formula

    However the formula fails if the maturity date is outside the given month's range. I have attached the file for your reference.

    Settlement Date Maturity Date
    11/01/2016 02/01/2017 #N/A Number of days interest paid should be 31
    Attached Files Attached Files

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,412

    Re: need help coming up with a formula

    Quote Originally Posted by ruchi1127 View Post
    However the formula fails if the maturity date is outside the given month's range. I have attached the file for your reference.

    Settlement Date Maturity Date
    11/01/2016 02/01/2017 #N/A Number of days interest paid should be 31
    Have you read my solution in #7? It solves the problem.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,396

    Re: need help coming up with a formula

    Quote Originally Posted by bebo021999 View Post
    I afraid that both of yours fail if the settle and Maturity dates are out of the date condition range.
    i.e 4/2 and 28/2/2017

    My suggestion:

    =MAX(0,MIN(B5,$B$2)-MAX(A5,$B$1)+(B5>$B$2))
    Yup. I missed another one.

+ 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. SUM of cells with values coming from a if formula
    By Tiago Sousa in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-28-2013, 06:07 PM
  2. Replies: 4
    Last Post: 12-28-2012, 04:38 PM
  3. VLOOKUP Formula coming back with NA#
    By monza2 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-18-2012, 01:38 AM
  4. Need help coming up with a formula
    By Icyblue024 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-23-2012, 04:13 PM
  5. Formula to warn end date coming up
    By The Hose in forum Excel General
    Replies: 1
    Last Post: 06-26-2011, 09:51 PM
  6. Values not coming in few cell but coming in rest all cells
    By rashmib in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2009, 11:19 AM
  7. need help coming up with a formula.
    By Sterling in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 12-13-2005, 08:08 PM
  8. [SOLVED] New user needing help with coming up with a formula
    By Igniter in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-02-2005, 03:05 PM

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