Forum Discussion

dsmith52's avatar
dsmith52
Copper Contributor
May 05, 2025
Solved

Hot to create a summary table by pulling data from two other tables using common ranges

Good day:  First, please note that I am blind, so need clear text based instructions.  I have a workbook containing three sheets.  One sheet has data in three columns, with columns a,b and c containing a list of unique product names, price and vender name respectively,  Sheet 2 contains a set of three columns, with column 1 containing entries for products by name, column 2 containing entries for whether the products were bought using cash/debic/credit, and the third column containing a numeric value for the number of that product sold in the transaction.  Sheet 3 is a summary sheet, where I want to create a list of products that appear in shehet 2 that are sold by a specific vender from sheet 1, then calculate the total price based on the number of items sold from sheet 2 for each item listed tiems the price from sheet1.  I can find filters and vlookups that will pull a vender and price from Sheet 1 if I know a product to search for, or the payment type and number of items sold from sheet 2 if I know a product name, but can't seem to find a function/formula that will do both and produce the desired output.  The rows in sheet 2 can change depending on data supplied, so I want to dynamically build the rows in sheet 3 as data is provided in sheet 2.  examples of data  Sheet 1 has three columns, with row 1 being bolts,$.10,company a.  row2: nuts,$.05,company a.  row 3: screws,$0.25,company b.  Sheet 2:  row 1 = bolts,credit,50  row 2 nuts,debit,50 row 3 screws,cash,100.  sheet 3 would have a summary table that might find all products sold from company a, so would list in row 1 bolts,credit,$5.00 ((50@$.1 each) row 2 would have nuts,debit,$2.50 (50@.05 each).  Since Company A does not sell screws, it would not appear.  I am new to Excel 2024 (desktop version).  Is there an easy way to do this withouthaving to resort to creating intermediate tables?

 

  • Thanks! My formula contained an error left over from experimenting, but it was also incorrect - it looked up only the product on Sheet 2, instead the combination of product and payment method.

    The formula should be

    =LET(Condition, XLOOKUP(Sheet2!A1:A100, Sheet1!A1:A100, Sheet1!C1:C100, "")=E1, Products, FILTER(Sheet2!A1:A100, Condition, ""), Payment, FILTER(Sheet2!B1:B100, Condition, ""), Amount, XLOOKUP(Products, Sheet1!A1:A100, Sheet1!B1:B100, 0)*XLOOKUP(Products&Payment, Sheet2!A1:A100&Sheet2!B1:B100, Sheet2!C1:C100, 0), HSTACK(Products, Payment, Amount))

    I have attached the corrected workbook.

     

6 Replies

  • I hope that this works in Excel 2024.

    Enter the vendor that you want to summarize in E1 on Sheet 3. In your example that would be company a.

    Enter the following formula in A1 on Sheet 3, replacing Sheet 1 and Sheet 2 with the names of those sheets in your workbook.

    =LET(Condition, XLOOKUP('Sheet 2'!A1:A100, 'Sheet 1'!A1:A100, 'Sheet 1'!C1:C100, "")=E1, Products, FILTER('Sheet 2'!A1:A100, Condition, ""), Payment, FILTER('Sheet 2'!B1:B100, Condition, ""), Amount, XLOOKUP(Products, 'Sheet 1'!A1:A100, 'Sheet 1'!B1:B100, 0)*XLOOKUP(A1:A2, 'Sheet 2'!A1:A100, 'Sheet 2'!C1:C100, 0), HSTACK(Products, Payment, Amount))

    • dsmith52's avatar
      dsmith52
      Copper Contributor

      Thanks for the reply, however when entering the formula as written, Excel complains that there are a number of circular references that can't be resolved, and puts an error in the cell where the formula is.  I have not fully figured out the formula (I will have to look up some of the commands/functions), but I also did not find a reference to the E1 cell mentioned in the instructions in the listed function.  Any suggestions?  Thanks.

       

      • Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?

Resources