+ Reply to Thread
Results 1 to 16 of 16

VLOOKUP and Calculation of Columns query

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    77

    Question VLOOKUP and Calculation of Columns query

    Hi
    I Have an excel spreadsheet attached which shows the following (example below) -full file in attached

    Date Name Mon Tue Wed Thu Fri Total
    06-07-18 Name1 1 1 1 1 1 5
    13-07-18 Name1 4 4 2 4 2 16
    20-07-18 Name1 5 5 3 5 3 21
    27-07-18 Name1 6 6 4 6 4 26
    06-07-18 Name2 7 7 5 7 5 31
    13-07-18 Name2 8 8 6 8 6 36
    20-07-18 Name2 9 9 7 9 7 41
    27-07-18 Name2 1 1 8 1 8 19
    06-07-18 Name3 2 2 9 2 9 24
    13-07-18 Name3 3 3 1 3 1 11
    20-07-18 Name3 4 4 2 4 2 16
    27-07-18 Name3 5 5 3 5 3 21

    I need to create a summary table showing for each of the Name entries Name 1, Name 2, Name 3 etc - I want the totals to be added together and recorded as a Summary answer so the resulting table would look something like

    Name 1 68
    Name 2 127
    Name 3 72

    I wondered if it is possible to do the summary table calculations through some clever functions e.g VLookup and Sum but cant get it working.

    One other point I had sorted them manually by Name order, but if it doesnt have to be sorted first and still give the same result that would be great.

    Thanks for any advice
    Attached Files Attached Files
    Last edited by Robbie8; 08-17-2018 at 06:18 PM. Reason: Missed out sort request

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,876

    Re: VLOOKUP and Calculation of Columns query

    Maybe use sub totals as shown in the attached.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: VLOOKUP and Calculation of Columns query

    Thanks Alan
    I see what you have done here, but the problem for me is that it needs a little more upfront work than I was hoping to do - Ive had to work out how many of each Name type there is and manually add the sub totalling into it. - I was trying to make it a little more automatic, so it didnt matter how many of each name type there were, it would till have been able to total it up - does that make sense? - Am I asking for the impossible and the way you have described is the only way?

    Thanks
    Rob

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    or... copied down:

    =IF(COUNTIF($B$2:B2,B2)=1,SUMIF(B:B,B2,H:H),"")

    There is an error in your expected results at name 4.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    10-15-2008
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    11

    Re: VLOOKUP and Calculation of Columns query

    I added a column to get the unique names on your table (replaced Calculated column):
    Column I:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For the Summary
    Names (Column M) :
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Total (Column N) :
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    I suspect Kenkie is on the right ttrack. If so, there is no need for the helper column.

    In L2:
    =IFERROR(INDEX($B$2:$B$29,MATCH(0,INDEX(COUNTIF($L$1:$L1,$B$2:$B$29),0),0)),"")

    In M2
    =IF(L2="","",SUMIF(B:B,L2,H:H))

    both copied down as far as needed.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    12-17-2013
    Location
    ON, Canada
    MS-Off Ver
    MS 365
    Posts
    171

    Re: VLOOKUP and Calculation of Columns query

    If you have access to, and are familiar with Power Query, that might be an option.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-22-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: VLOOKUP and Calculation of Columns query

    Thank you all - your replies are perfect.
    Sorry Flyboy I dont know PowerQuery - I barely know excel
    One more question, in column L we are searching $B$2:$B$29. Is there a way of searching when you dont know the number of rows , i.e. $B$2:$B$n

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    I'm away for the night. But yes, you can. The best way is to use a dynamic named range. I'll set one up in the morning.

  10. #10
    Registered User
    Join Date
    10-15-2008
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    11

    Re: VLOOKUP and Calculation of Columns query

    Nice! Thanks Sir Glen for your better approach.
    Sir Flyboy, you can adjust row 29 to 1000 or any number you want, please see revised formula of Sir Glenn in "L2".
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    I's use a named range. CTRL-F3 to view edit:

    =Sheet1!$B$2:INDEX(Sheet1!$B$2:B$10000,COUNTA(Sheet1!$B$2:$B$1000))

    This will look down 10,000 rows in column B and set the range automatically, to fit the size of your data. It's been called Names. Then the formula in L2 becomes:

    =IFERROR(INDEX(Names,MATCH(0,INDEX(COUNTIF($L$1:$L1,Names),0),0)),"")

    That said, Kenkie's suggestion will also work perfectly well.
    Attached Files Attached Files

  12. #12
    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,777

    Re: VLOOKUP and Calculation of Columns query

    Quote Originally Posted by Glenn Kennedy View Post
    I's use a named range.
    Ah, me hearty!!!
    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.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    Pre-caffeine typo... Or Fat Finger Syndrome (they're not, as it happens...).

  14. #14
    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,777

    Re: VLOOKUP and Calculation of Columns query

    I'm on my third already - buzzing!!!

  15. #15
    Registered User
    Join Date
    03-22-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: VLOOKUP and Calculation of Columns query

    thank you everyone who has responded - my calculation is now working perfectly.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP and Calculation of Columns query

    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.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. Query calculation
    By malacqua in forum Access Tables & Databases
    Replies: 4
    Last Post: 08-22-2016, 03:16 PM
  2. Query calculation
    By malacqua in forum Access Tables & Databases
    Replies: 1
    Last Post: 08-19-2016, 07:34 PM
  3. [SOLVED] Formula - adding an IF Query onto vlookup query
    By mra1984 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-06-2013, 05:31 AM
  4. [SOLVED] How to offset a vlookup query by x columns to the left
    By datthed in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-29-2012, 01:25 PM
  5. calculation query
    By davidpulley in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-25-2010, 02:58 PM
  6. Query Data in hidden rows/columns with Query Box
    By VincetOmnia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 10:53 PM
  7. MS Query Calculation in Excel
    By uberised in forum Excel General
    Replies: 0
    Last Post: 09-18-2009, 04:35 AM

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