Return the Sum of Two or More Columns with VLOOKUP

Lookup Range by Jeff Lenning

If you have ever wished that the VLOOKUP function could return the sum of two or more related columns, this trick will get you there.


Before we get into the details, let’s be clear about our objective. We have some transactions that were exported from our accounting system as shown below.

Transactions by Jeff Lenning

We would like to write a formula that will look up any given TransID and return the sum of three columns, Amount, Shipping, and Tax. This is illustrated in the screenshot below, where we enter a TransID such as 10578 and Excel computes the Total (1,076.36 = 1,006 + 10 + 60.36).

VLOOKUP by Jeff Lenning

Since this is essentially a lookup task, our first instinct is to use VLOOKUP. However, we know that VLOOKUP can only return one related value, not the sum of multiple related values.

One common workaround is to add a helper column to the data that sums the three columns and then use a VLOOKUP to return the value from the new helper column. However, whenever possible in practice, we prefer to work with the data as it comes so that the workbook is easy to update in future periods.

Another common workaround is to write a formula that adds up three VLOOKUP functions, such as the following.

=VLOOKUP(...) + VLOOKUP(...) + VLOOKUP(...)

However, such a formula can be difficult to update and maintain over time since any change to the arguments need to be made three times instead of once. The good news is that we can wrap a SUMPRODUCT function around a single VLOOKUP function. Let’s get started.


When the SUMPRODUCT has a single argument, it behaves much like the SUM function because it simply returns the sum of the values. When the SUMPRODUCT has multiple arguments, it returns the sum of the product of its arguments. To accomplish our objective, we will use the SUMPRODUCT to return the sum of the values in a single argument.

Basically, we will wrap a SUMPRODUCT function around a VLOOKUP function that returns an array of values, specifically, the related values from multiple columns. The SUMPRODUCT will sum the values in the array returned by the VLOOKUP function. How do we convince the VLOOKUP function to return an array of values? That brings us to our next discussion.

Technical Note: we need to use SUMPRODUCT instead of SUM because the SUMPRODUCT function is designed to work with arrays and will thus return the sum of the array returned by the VLOOKUP function. The SUM function would return the sum of the first array element only. However, you could use the SUM function and then array-enter it with Control+Shift+Enter if preferred.

Array of Values

We can ask the VLOOKUP function to return an array of values by enclosing the third argument in curly braces {}. This causes the VLOOKUP function to actually return an array that contains multiple elements. For example, if we wanted the VLOOKUP function to return the values from the 3rd, 4th, and 5th columns to an array with three elements, we could use the following formula.



  • C6 is the lookup value
  • B12:F18 is the lookup range
  • {3,4,5} are the column numbers that have the values we want returned, enclosed in curly braces to create the array of values
  • 0 tells VLOOKUP to use exact match logic

This VLOOKUP function actually returns an array of values, and the array elements are 1006, 10, and 60.36. If you enter it into a single cell and press Enter, Excel will display only the first element. But, we don’t want to display the first element, we want to compute the sum of all array elements. So, let’s put it all together and bring it home.

Technical note: you can confirm the VLOOKUP returns an array of values by array-entering the formula into three cells across at once (Ctrl+Shift+Enter). Excel will display the three array elements in the three cells.


Now that we understand that using the curly braces causes VLOOKUP to return an array of values, let’s add up the values in the returned array with the SUMPRODUCT function.

Here is a screenshot of our workbook.

SUMPRODUCT by Jeff Lenning

The formula in C7 follows.


The SUMPRODUCT function returns the sum of the array elements returned by the VLOOKUP function. This is essentially the same as SUMPRODUCT({1006, 10, 60.36}), which returns 1076.36.

When we press Enter, we confirm that it works as expected…yes!

Results by Jeff Lenning

Note: there is no need to array-enter this formula by using Control-Shift-Enter.

And that my friend is one way to return the sum of two or more columns with VLOOKUP. If you have another approach, please share by posting a comment below…thanks!

Additional Resources



This article was written by jefflenning


  1. joe szczepaniak

    That’s really clever! How did you run across the option of putting an array of columns into the VLOOKUP function?

    1. jefflenning Post author

      That technique came from a participant in a discussion during one of my Excel sessions…pretty cool!
      There is so much to learn about Excel…I wish I had discovered that trick years ago :-)

  2. Jon D Schaefer

    Excellent – thank you. Is there any way to replace the {3,4,5} part with a name? Like can I name a group of columns and reference them that way? Not finding anything about naming an array.

    1. Kurt LeBlanc

      Hey Jon,

      You can create a named formula, as in ={3,4,5}, and use that instead:)

      Let me know if you need anymore help!
      Kurt LeBlanc

  3. Nick

    Jeff, this is a really cool solution.
    More to the point – you explain it clearly and succinctly in a way that is not only easy to follow, but helps to ‘stick’ it in the brain.
    You’re clearly a gifted teacher.


    1. jefflenning Post author

      Thanks :-)

  4. jain_tech

    Will this similarly work with hlookup?

    1. Kurt LeBlanc

      Correct! It works because SUMIFS() works horizontally as well as vertically.

  5. Srikanth

    Thanks for the useful information.. I would like to add multiple values which are in the same column (unlike the example here where the addition is along the same row)…How do I do that. Can you please suggest.?

    1. Kurt LeBlanc

      Hey Srinkanth!

      Absolutely, with HLOOKUP:) It is exactly the same logic fortunately, just with nth row as the third argument instead of column. If you transpose the table in the sample file and adjust the lookup formula to HLOOKUP(), you can see hat even the array works as expected:)

      Let me know if you need any help with the setup,
      Kurt LeBlanc

      1. shaibajit

        Hi Kurt,
        My table area is A1:K30. My Lookup value matches with H1. And I want to add from H10 to H28. Instead of writing all the row numbers from 10 to 28 withing HLookup [ like – hlookup{10,11,12,13,…….,26,27,28} ] is there any other options?

        1. Kurt LeBlanc

          I understand now:)

          Unfortunately, you have to enter each of the individual numbers in the array…or you can create a named formula that refers to the array, and use that in your lookup.

          Let me know if that is clear
          Kurt LeBlanc

  6. Adrian Ramirez

    This post is to subscribe to follow-up emails (meant to do that earlier, but forgot)

    1. jefflenning Post author


Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.