lookup

rduke

Board Regular
Joined
Nov 27, 2002
Messages
53
I have the following table


Table A
TN ECC 12
TN NTL 7
TN PORTLAND 12
TN CANAPORT 12
TN USAC 16
TN HFX/Pt.Tupper 9.5
WR ECC 14
WR PORTLAND 14
WR CANAPORT 14
WR USAC 18
WR NTL 8
WR HFX/Pt.Tupper 11
HIB NTL 6
HIB PORTLAND 6
HIB CANAPORT 6
HIB USAC 15
HIB ECC 11
HIB HFX/Pt.Tupper 9



In another table I have the following

Cargo Days Port Total
TN11 5 NTL
WR05 5 Portland
HIB23 5 Canaport



In the total column I need excel to look and see if the cargo number starts with TN, or WR, or HIB and then check the Port in table A and then assign the right number from Table A

Help
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
if your tables are in
A1:C18


and H1:K4


then in D1 I would put in a helper column of A1&B1

then for your totals in k2:k4 do

in k2 put in =OFFSET($D$1,MATCH(LEFT(H2,IFERROR(IF(FIND("HIB",H2),3,2),2))&J2,D1:D18,0)+1,-1)

and copy down. Not very robust but works for the given data.
 
Upvote 0
Works with all versions of excel, no helpers needed.

Excel Workbook
ABCDEFGH
1Table ACargoDaysPortTotal
2TNECC12TN115NTL7
3TNNTL7WR055Portland14
4TNPORTLAND12HIB235Canaport6
5TNCANAPORT12
6TNUSAC16
7TNHFX/Pt.Tupper9.5
8WRECC14
9WRPORTLAND14
10WRCANAPORT14
11WRUSAC18
12WRNTL8
13WRHFX/Pt.Tupper11
14HIBNTL6
15HIBPORTLAND6
16HIBCANAPORT6
17HIBUSAC15
18HIBECC11
19HIBHFX/Pt.Tupper9
Sheet5
 
Upvote 0
=f2+sumproduct(--isnumber(find($a$2:$a$19,e2)),--($b$2:$b$19=g2),$c$2:$c$19)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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