Lookup from two tables and sum results

Tashat

Board Regular
Joined
Jan 12, 2005
Messages
135
Office Version
  1. 365
Platform
  1. Windows
Hi All

I would really appreciate some help with a formula. I need to perform vlookup (I think) which looks up values in two lookup tables and sums the total. I have a main table with hundreds of locations and two lookup tables where there are some locations in one and some locations in the other. Some are repeated (e.g. location 1 appears in both tables) and others only appear in one or the other lookup table (e.g. Location 2 only appears in lookup table 1 and location 4 only appears in lookup table 2). I have included a simple example below with the totals showing in B4:B11 as I want them to appear, but I can't do this manually for my actual table which has hundreds of rows. I also don't want an error to return if the location can't be found in one of the tables. If possible I'd like to avoid using macros. Can anyone help?

Many thanks in advance.


Mr_Excel_Query_Two_Lookups.xlsx
ABCDEFG
1Main Table
2
3Location NameTotal
4Location 16
5Location 24
6Location 32
7Location 43
8Location 52
9Location 610
10Location 74
11Location 81
12
13
14
15
16Lookup table 1Lookup table 2
17
18Location NameValueLocation NameValue
19Location 12Location 14
20Location 24Location 31
21Location 31Location 43
22Location 52Location 64
23Location 66Location 71
24Location 73
25Location 81
26
27
Sheet1
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Into B4:

Excel Formula:
=IFERROR(VLOOKUP($A4,$A$18:$B$25,2,0),0)+IFERROR(VLOOKUP($A4,$E$18:$F$23,2,0),0)

and drag it down.
 
Upvote 0
Solution
Edit: Ah yes I've got it to work!!! Thank you KOKOSEK!
 
Upvote 0
Into B4:

Excel Formula:
=IFERROR(VLOOKUP($A4,$A$18:$B$25,2,0),0)+IFERROR(VLOOKUP($A4,$E$18:$F$23,2,0),0)

and drag it down.
Hi! This is brilliant thank you.

Do you know if there is a way of changing the formula so that cells with 0 are just empty/blank?
 
Upvote 0
Excel Formula:
=If(And(A1<>"",A1>0),IFERROR(VLOOKUP($A4,$A$18:$B$25,2,0),0)+IFERROR(VLOOKUP($A4,$E$18:$F$23,2,0),0),"")
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top