+ Reply to Thread
Results 1 to 20 of 20

SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

  1. #1
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Hello,

    I need your help to come up with a one-cell formula to calculate a sumproduct for all the rows. In sheet 1, I have names in col#1 and hours in col#2. In sheet 2, I have same names in col#1 but not in the same order as sheet 1 and col#2 has rate/amount. I can create one more column col#3 in sheet 1 to get "rate/amount" from sheet 2 using vlookups. Then do sumprocut at the bottom for grand total. What I want to do if possible is nest both vlookup and sumproduct in one-cell instead of cell by cell.

    Sheet 1
    Name Hours
    ABCD 16
    DEF 30
    GHI 10
    HKL 40

    Sheet 2
    Name Rate
    HKL 100
    DEF 80
    GHI 80
    ABCD 60

    One possible way of doing is
    Sheet 1
    Name Hours Sumproduct vlookup for each cell
    ABCD 16 sumproduct(vlookup(abcd,sheet2,2,0)*hours = 60*16

    Then add the total of each cell.

    Hope I did not make it appear to complicated. What I am hoping to do is nest all of these in once cell to calculate grand total (without creating a new column for lookup or sumproduct) - i.e., perform sumproduct for all rows by looking up at respective values from another table and show it in one cell.

    Please let me know if you need more information. Thanks in advance for your time and help.
    Attached Files Attached Files
    Last edited by krishkarthik; 07-27-2018 at 10:33 AM. Reason: Sample file

  2. #2
    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,002

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    are you sure you don't want a sumif or sumifs for that? A vlookup will only find the first instance of an item and return that. A sumif will return the sum of all instances of something. Or maybe you simply want a vlookup and at the end the multiplication of the value returned to get the hours? A sample sheet might be a help, one with representative samples of your data AND expected results. Go advanced to attach a sheet.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Thank you, Glen, for your help and instructions to post the attachment. I have created a sample file and attached in my original post.

  5. #5
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Quote Originally Posted by Sambo kid View Post
    are you sure you don't want a sumif or sumifs for that? .
    Thank you, Sambo, for your reply. I can do SUMIF or SUMIFS if I create a new column for each row/name. I would like to get the grand total of sumproduct in one cell. I have attached a sample. Hope that helps.
    Last edited by AliGW; 07-27-2018 at 10:44 AM.

  6. #6
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Quote Originally Posted by Glenn Kennedy View Post
    Will you please attach a SMALL sample Excel workbook ...
    Thank you, Glen. I have attached a sample file.
    Last edited by AliGW; 07-27-2018 at 10:44 AM.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Macro or UDF will do?
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  8. #8
    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,647

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    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.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Pl see file.
    ARRAY Formula. Pl see note below.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Thanks kvsrinivasamurthy. Appreicate your help. It took some time to undesrstand the formula as I never used MMULT. This is very helpful.
    Last edited by krishkarthik; 07-27-2018 at 03:21 PM.

  11. #11
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    I was not sure which one was appropriate. Will use "reply" instead of "reply with quote" in the future.

  12. #12
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Based on Post #.1 attachment,

    In C6, enter :

    =SUMPRODUCT(VLOOKUP(T(IF({1},A2:A5)),Sheet2!$A$1:$B$5,2,0),B2:B5)

    Returned the desire result : 8160

    and,

    kvsrinivasamurthy's formula (Post #.9) result : 7260 is correct.

    Regards
    Bosco

  13. #13
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    I just updated the formula to incorporate with the actual data. It looks like the number of rows in the lookup table (Sheet 2) and Sheet 1 should be the same. Otherwise, it doesn't work - gives "#VALUE" Error. Is there a workaround to fix when the number of rows is not the same? It would be nice to have no limitations regarding row size as the table keeps increasing. It would also be helpful if you could kindly explain the need of ROW function at the end. Alternatively, is it possible to calculate using the sumproduct function by any chance to make it more simpler? :-) Thanks a lot!

  14. #14
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Thanks Bosco! Yes, he was right, I just got confused. Update my reply. Between, thanks for the formula. This worked for me :-). Would you mind explaing the purpose of {1} in this formula?

  15. #15
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    The return value of INDEX can use as a cell reference,

    and,

    T(IF({1},Array)) can use as array reference

    Regards
    Bosco

  16. #16
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Does both the tables vary or any one.

  17. #17
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12
    Quote Originally Posted by kvsrinivasamurthy View Post
    Does both the tables vary or any one.
    Thanks for your response. Both the tables can vary. This is because as the name of resources get added, the rate card table also gets updated. But if resources are removed, they may still be in the rate table.

  18. #18
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Pl upload a sample file

  19. #19
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Revised formula so that Rows can be changed in both Sheets
    Please Login or Register  to view this content.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    07-27-2018
    Location
    New york
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: SUMPRODUCT for all cells with VLOOKUP or IF or SUMIFS

    Thanks for your help. Much appreciated!

+ 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. Replies: 4
    Last Post: 11-22-2017, 09:05 PM
  2. Sumifs & sumproduct not calculating correctly in worksheet
    By Tieddyekid in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-04-2016, 12:50 AM
  3. [SOLVED] Help with SUMIFS or SUMPRODUCT
    By Dan_Ludwig in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-24-2015, 09:35 AM
  4. sumproduct() with sumifs()?
    By hatzopoulos in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-11-2015, 02:25 AM
  5. [SOLVED] SUMIFS or SUMPRODUCT???
    By PERE in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-25-2013, 11:52 AM
  6. [SOLVED] SUMIFS to SUMPRODUCT
    By plsm5882 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-31-2013, 05:30 PM
  7. Sumproduct/sumifs?
    By MjRmatt in forum Excel General
    Replies: 4
    Last Post: 07-30-2010, 08:09 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