+ Reply to Thread
Results 1 to 22 of 22

npv with dynamic range

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    npv with dynamic range

    Hi,

    I am trying to calculate NPV on a range of values that may change. I am attaching an excel file that i think explains it the easiest.

    Thanks!

    NPV with dynamic range.xlsx

  2. #2
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    i think i got it. Does this make sense?

    =NPV(0.05,INDEX(B2:K2,MATCH(A1,B1:K1)):K2)

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: npv with dynamic range

    Hi,
    See attached,

    I have assumed that when you say 'After the year in A1' you mean starting with the next year. So if 2018 is in A1 the NPV is for years 2019-2024
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    Thanks Richard. Based on my statement "after the year in A1" your answer is spot on. Thanks! However, I think it may be easier to just assume that the year in A1 is the first year "discounted." The solution I came up with seems to work. See my updated attachment. Thoughts? Thanks again!!!NPV with dynamic range.xlsx

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: npv with dynamic range

    Yes, your method is perfectly OK and indeed better than mine since it's shorter - always a good thing.

  6. #6
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    i ran into a problem. using the formula in the attachment I provided (post 4), if i delete a column (say I don't need column K) or I need to add columns the formula does not adjust. Am i missing something or is this limitation of my syntax????
    Last edited by duvius; 05-29-2015 at 09:57 AM.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: npv with dynamic range

    Hi,

    With the column delete I'm not sure what you mean by the the formula doesn't adjust. Take the column B formula
    =NPV(0.05,B2:K2)

    deleting column K, or indeed any of the other columns changes the formula to
    =NPV(0.05,B2:J2)

    Similarly if you were to Add a column before column K the formulae would adjust to reflect the larger range, i.e. column B formula would be
    =NPV(0.05,B2:L2)

    The only case where the formula wouldn't adjust would be adding a column after column K.
    You can get round this by changing the B3 formula to
    =NPV(0.05,OFFSET(B2,0,0,1,COUNTA(2:2)))

    and copying this across.

  8. #8
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    I think if you go into this file you will see what I am talking about. if you delete K you get a #ref error. Also row 3 is mostly irrelevant. it was mainly to check formula in A2. The formula in A2 is the one that needs to adjust when a column is deleted (or added)

    NPV with dynamic range.xlsx
    Last edited by duvius; 05-29-2015 at 11:31 AM.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: npv with dynamic range

    OK,

    I thought you were talking about the row 3 formulae.

    Use instead in A2

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    okay thanks. that works in the prior attached example. However, when i tried to put it into my big model it didn't work. I tried to replicate what is going on in my model and I backed into the formula but I don't understand why it is working. Can you please help me understand? Mainly why the col adjustment of -7???
    Last edited by duvius; 05-29-2015 at 12:36 PM.

  11. #11
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    NPV with dynamic range (2).xlsx
    here is the revised attachment

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: npv with dynamic range

    Hi,

    The -7 (or -2 in the original example) is necessary since your data starts in column 7.

    The MATCH(C2,3:3) bit of the formula returns the column number for the year in question. i.e. column 11 (K) if 2019 is selected. Hence we need to deduct 7 to bring the OFFSET (third column parameter) back to a value of 4 meaning the Offset start point is G + 4 = column K

  13. #13
    Registered User
    Join Date
    04-19-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: npv with dynamic range

    okay. i need to chew on this a little. I get most of it. Thanks so much!

  14. #14
    Registered User
    Join Date
    07-09-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    4

    Re: npv with dynamic range

    HI Everyone, thank you for the solutions presented.

    I have a question that I hope you can help me with (this is a variant of the problem statement original posted)

    I have an excel file with each row representing different projects, each project starts at different periods (assume we want to measure NPV for 6 years each)...
    I want a formula to do NPV for each project. But need to be able to do it in each row with different time frames (start and end date)

    How would you set this up?

    Thank you in advance

    (Attached a file with the example)
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor
    Join Date
    07-13-2021
    Location
    California, USA
    MS-Off Ver
    2010
    Posts
    513

    Re: npv with dynamic range

    @ExcelForumOG.... Fortunately, Excel NPV is toleratant of empty cells and even cells with text. They are ignored.

    So you can enter =NPV(10%,E7:L7) into N7 and copy down the column with no changes.

    As proof of concept, note that the results in column O, where each NPV is tailored to just the applicable cash flows, is the same as column N, per column P.


    -----
    Attached Images Attached Images
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    07-09-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    4

    Re: npv with dynamic range

    Thank you - how would you avoid if people plug in zeroes, before the start of the project since zeroes will change the NPV.

  17. #17
    Valued Forum Contributor
    Join Date
    07-13-2021
    Location
    California, USA
    MS-Off Ver
    2010
    Posts
    513

    Re: npv with dynamic range

    Quote Originally Posted by ExcelForumOG View Post
    how would you avoid if people plug in zeroes, before the start of the project since zeroes will change the NPV.
    Right, but only for zeros in the earlier periods.

    And I wouldn't "avoid" it. Zeros in earlier periods have meaning, when used correctly. It means that "t0" (the year of present value) is before the first non-zero cash fllow. For example, you might want to compare the NPV to 2019 of Project 3 with delaying the project until 2021 (Project 1). In that case, we might want to account for the time-value of the delay.

    So I guess I would "avoid" it by telling such people: GIGO! But if they insist on seeing meaningless zeros, tell them to enter it as text; e.g. ="0" or '0 (apostrophe zero). Again, Excel NPV ignores text as well as empty cells.

    Of course, if you insist, we could complicate the NPV formula to ignore early zero periods. But that can be messy.

    PS.... You are "responding" to a discussion that ended 7 years ago. I responded when I thought the question could be resolved quickly. If you continue to have follow-up questions, I think you should start a new discussion.
    Last edited by curiouscat408; 07-09-2022 at 04:48 PM.

  18. #18
    Registered User
    Join Date
    07-09-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    4

    Re: npv with dynamic range

    Thank you that was pretty helpful!

  19. #19
    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,933

    Re: npv with dynamic range

    Quote Originally Posted by ExcelForumOG View Post
    HI Everyone, thank you for the solutions presented.

    I have a question that I hope you can help me with (this is a variant of the problem statement original posted)

    I have an excel file with each row representing different projects, each project starts at different periods (assume we want to measure NPV for 6 years each)...
    I want a formula to do NPV for each project. But need to be able to do it in each row with different time frames (start and end date)

    How would you set this up?

    Thank you in advance

    (Attached a file with the example)
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    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

  20. #20
    Registered User
    Join Date
    07-09-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    4

    Re: npv with dynamic range

    My apologies, first time posting.

    Thanks

  21. #21
    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,933

    Re: npv with dynamic range

    Quote Originally Posted by ExcelForumOG View Post
    My apologies, first time posting.

    Thanks
    Not a problem

  22. #22
    Registered User
    Join Date
    07-19-2023
    Location
    Baltimore, MD
    MS-Off Ver
    2018
    Posts
    1

    Re: npv with dynamic range

    This formula is great! I used it in a real estate deal I'm modeling and it worked perfectly. Was trying to understand how the index function works if you are not inputting a row number (Match seems to only reference the column.) 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. Match ComboBox with dynamic range, then add Textbox1 to dynamic range
    By Lasse Moe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2014, 01:26 AM
  2. Dynamic Range Column Chart w/ Dynamic Avg Line (Excel 2007)
    By BrokenBiker in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-04-2012, 11:40 AM
  3. Fill Dynamic Range From Dynamic Source Range
    By goss in forum Excel General
    Replies: 2
    Last Post: 03-06-2012, 12:05 PM
  4. Replies: 2
    Last Post: 02-02-2006, 04:10 PM
  5. select dynamic range with dynamic start point
    By Juli in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2005, 08:05 PM

Tags for this Thread

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