30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / Combine VLOOKUP with SUMIF
By Puneet Gogia (Microsoft MVP)

Combine VLOOKUP with SUMIF

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

You can nest VLOOKUP inside SUMIF’s criteria argument when the value you need to sum by isn’t the one you have. The formula is =SUMIF(A2:A13,VLOOKUP(B15,D2:E7,2,0),B2:B13): VLOOKUP takes the product name in B15, returns its product ID from the reference table, and SUMIF then totals the quantity column for every row carrying that ID.

So a user picks a readable name — ideally from a dropdown in B15 — while the data itself stores codes. The same works across sheets by adding the sheet name to the lookup range: =SUMIF(A2:A13,VLOOKUP(B15,Sheet2!A2:B7,2,0),B2:B13).

Two things to guard against. If VLOOKUP can’t find the name it returns #N/A, and SUMIF passes that straight through instead of returning 0 — wrap it as =IFNA(SUMIF(...),0).

And the ID VLOOKUP returns must match the ID column exactly: a trailing space or a code stored as text on one side gives you 0 with no error.

Yes, you can combine VLOOKUP and SUMIF. In SUMIF, there is a criteria argument in which you can use VLOOKUP to create a dynamic value. This will allow you to change the criteria by changing the lookup value in the VLOOKUP. The use of this combo formula is unique.

combine-vlookup-with-sumif

In this tutorial, we will learn to combine SUMIF and VLOOKUP to create a formula.

Combine SUMIF and VLOOKUP

  1. First, in a cell enter “=SUMIF(“, for the range argument, refer to the product ID range that you have in table1.
  2. After that, in the second augment, you need to use the VLOOKUP function to lookup for the product ID by using the product name from the cell above.
  3. Next, in the third argument of the SUMIF, refer to the quantity column to use as a sum_range.
  4. In the end, enter the closing parentheses and hit enter to get the result.
sumif-and-vlookup-combined

=SUMIF(A2:A13,VLOOKUP(B15,D1:E7,2,0),B2:B13)

sumif-with-vlookup-formula
[thrive_leads id=’112075′]

How this Formula Works

Let’s break this formula into three parts: In the first part, you have specified the range where you have the product ID.

sumif-formula-first-part

In the second part, you have the VLOOKUP that takes the product name from cell B15 and lookup it in the table2. For Headphones, we have the Product ID OT-356.

vlookup-in-second-part

In the third part, we have the quantity column as sum_range.

third-part-contains-sum-range

In short, VLOOKUP helps you find the Product ID with the Product Name and then SUMIF takes that Product ID and looks it up in the Product ID column, and then sums values from the Quantity column.

As I said, when you use SUMIF and VLOOKUP, this makes your formula a dynamic formula. When you change the product name in the cells it changes the result.

sumif-vlookup-make-formula-dynamic

SUMIF and VLOOKUP in Multiple Sheets

You can use this combination even when you have both tables in multiple sheets differently.

sumif-vlookup-in-multiple-sheets

In the above example, you have the product name table on a different sheet.

Get the Excel File

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment