+ Reply to Thread
Results 1 to 12 of 12

sum multiple rows vertical lookup

  1. #1
    Registered User
    Join Date
    02-13-2015
    Location
    Brussels
    MS-Off Ver
    2007
    Posts
    13

    sum multiple rows vertical lookup

    Hello,

    I am creating a vertical lookup for which I want to sum up the data to a corresponding date over several days, formula I have now is

    =VLOOKUP(B813 (date);pickups!A1:ST10000;2+3+4+5+6+7+8+9+10;FALSE)

    each + will correcpond to a different column index but it looks like its not summing up...
    even though column indexes 2 to 6 have value 0 for a specific lookup value, column 8 to 10 contain data but the outcome in the cell now remains 0. Anybody can correct my lookup?

    Thank you in advance.

    Best Regards,

    Tim

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

    Re: sum multiple rows vertical lookup

    Not testing yet, but try:

    Please Login or Register  to view this content.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Quang PT

  3. #3
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: sum multiple rows vertical lookup

    You could write a formula that sums 10 individual VLOOKUPS, but there is most likely a simpler method. To help you more, we'd need to know how your data is setup. Can you upload a sample workbook?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sum multiple rows vertical lookup

    I would do it like this

    =SUM(INDEX(pickups!B1:J10000;MATCH(B813;pickups!A1:A10000;0);0))

  5. #5
    Registered User
    Join Date
    02-13-2015
    Location
    Brussels
    MS-Off Ver
    2007
    Posts
    13

    Re: sum multiple rows vertical lookup

    Online exmaple.xlsx

    I hope this file is correctly attached.
    First of all WOW, what a fast replies and thank you all! My first time here and I am impressed by the response time... Tried the 2 options provided unfortunately (i did not get them) work.

    Attached version short example.
    For Columns E,F,G I need teh sum of several dates from Tab Pickups
    Tab Pickups is daily updated by macro, as Is Column C in Overview BRUC! and column D will refer to that (=)
    In overview BRUC! I need to import the lookup values in Column B from pickup! corresponding to the number of columns mentioned above in Column E, F, G (e.g. 7, 14, 31 days)
    As you might see in Pickups! the macro inputs new data (on the date the macro runs) inserting data in column B.

    I hope I make myself clear, not easy to explain clearly...

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sum multiple rows vertical lookup

    It's difficult to see what results you want in which cells...

    Can you manually fill out formulas (setting the desired ranges by hand) in a small portion of that, say D3:G5 ?

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

    Re: sum multiple rows vertical lookup

    One way with SUMPRODUCT:

    Pickup to day, in D3:

    =SUMPRODUCT((pickups!$A$2:$A$404=$B3)*(pickups!$B$1:$Y$1=$B3)*pickups!$B$2:$Y$404)

    Pickup last 7 days, in E3:

    =SUMPRODUCT((pickups!$A$2:$A$404=$B3)*(pickups!$B$1:$Y$1<=$B3)*(pickups!$B$1:$Y$1>=$B3-7)*pickups!$B$2:$Y$404)

    Adjust value in red with 14 or 31

  8. #8
    Registered User
    Join Date
    02-13-2015
    Location
    Brussels
    MS-Off Ver
    2007
    Posts
    13

    Re: sum multiple rows vertical lookup

    So, the pickups (E-G) are coming from TAB Pickup. only thing is that the formula needs to do a Vlookup from value row A in tab Overview BRUC when calculating values as the dates might change and not always be in the same row.

    Online exmaple.xlsx
    Last edited by tim browne; 02-13-2015 at 11:18 AM. Reason: adding correct file

  9. #9
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: sum multiple rows vertical lookup

    Along the same lines as Bebo's, but column G's formula takes into account the last month's date relative to today's, so that months with less than 31 days doesn't throw off the formula.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sum multiple rows vertical lookup

    Pretty much the same as my original answer.
    You just have to adjust the columns for each formula in column E F and G

    E3: =SUM(INDEX(pickups!$B$2:$H$361,MATCH($B3,pickups!$A$2:$A$361,0),0))
    F3: =SUM(INDEX(pickups!$B$2:$O$361,MATCH($B3,pickups!$A$2:$A$361,0),0))
    G3: =SUM(INDEX(pickups!$B$2:$Y$361,MATCH($B3,pickups!$A$2:$A$361,0),0))

    Then fill all 3 down.

  11. #11
    Registered User
    Join Date
    02-13-2015
    Location
    Brussels
    MS-Off Ver
    2007
    Posts
    13

    Re: sum multiple rows vertical lookup

    WOW, going over my head...
    maybe my example upload was not correct, because the pickup tab's data has much more data, this is a shortened version due to the fact that the upload was too big.
    is has data from 2010 until 2030 in rows and all previous records from 2 years ago in the columns. However the calculation should be made on the count of rows and not per definition the exact number of days (new columns only insert when the macro is run and that for instance doesn't happen in weekends)...
    Also the dates in Tab daily overview will usually be the same per standard but might change in the future that why I was looking for the Vlookup...
    I thought indeed of summing all individual vlookups per column (meaning the month will have the sum of 31 vlookups), but indeed there shgould be an easier way.
    Also the table array from the lookup will be the whole TAB pickups, starting with lookup value in column A but with unlimited ending, can that be set in a formula?

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

    Re: sum multiple rows vertical lookup

    I think SUMPRODUCT as per mine and mcmahobt's introduction (#7 and #9) is able to update your data growing up.

    Change the current range $B$2:$Y$361 to as far as you need ($B$2:$ZZ$361 for example).

+ 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] Macro to equalize the top rows of multiple vertical ordered tables
    By VincentNL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2014, 10:58 AM
  2. Horizontal and vertical lookup with sum across multiple worksheets
    By janeyjanejane78 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-11-2014, 06:15 PM
  3. [SOLVED] Lookup Multiple Results of Same Value In A Vertical Data Set.
    By adil.master in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-29-2014, 10:23 PM
  4. Replies: 2
    Last Post: 06-06-2012, 07:13 PM
  5. Convert multiple rows into one, vertical to horizontal data
    By ortho-research in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2009, 01:07 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