+ Reply to Thread
Results 1 to 3 of 3

Help with Vlookup plus adding a user-input number of adjacent cells

  1. #1
    Registered User
    Join Date
    07-15-2015
    Location
    California
    MS-Off Ver
    10
    Posts
    35

    Help with Vlookup plus adding a user-input number of adjacent cells

    So in the attached spreadsheet I have a Vlookup formula in cell F5 that works quite well based on the given input in the orange cells to the left.

    I need to calculate the total cost in cell G5.

    Currently I have C4 * F4 to calculate this however this is not right. I need to lookup the year in C3 and add the subsequent years (however many the user inputs in C4).

    For example if someone inputs Cambridgeshire, 2019, and 3 years. The total cost in cell G4 should add up the cost for years 2019+2020+2021 to get the total cost of 135,087 NOT 131,113

    This needs to work for any number of input years so if someone inputs 10 years, it will add up the start year plus the next 9.

    Thanks for your help!
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Help with Vlookup plus adding a user-input number of adjacent cells

    Here, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Help with Vlookup plus adding a user-input number of adjacent cells

    Use this array* formula in G5:

    =SUM(IF(ROW(A1:A10)<=C4,VLOOKUP(C2,'Residential Care Annualy'!A2:AA59,MATCH(C3+ROW(A1:A10)-1,'Residential Care Annualy'!A1:AA1,0),FALSE)))

    *An array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual <Enter>.

    Hope this helps.

    Pete

+ 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] Adding additional formatted cells using user input
    By dannyjoer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2014, 08:36 AM
  2. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  3. Get input from user using application.inputbox. Input should be number and can be 0
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2013, 11:28 AM
  4. User input number minus a set of cells?
    By espyder in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-24-2012, 07:28 PM
  5. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 PM
  6. Adding Rows depending on user input
    By haitham1984 in forum Excel General
    Replies: 0
    Last Post: 11-09-2008, 02:35 AM
  7. Adding new sheet with User Input
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2007, 11:45 PM
  8. Adding input box number to range of cells values
    By Jessica in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2006, 02:10 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