Vlookup with 4 criteria

Lizard07

Board Regular
Joined
Jul 20, 2011
Messages
103
Hello - I am trying to combine two spreadsheets of information into one. The first contains trip leg miles and the second contains the activity associated with each leg.

I need a vlookup (or a formula similar to) that will lookup information based on four critieria: route ID (column E), latitude (column L), longitude (column M), and date (column F). If it is a match I would like it to return the information in column O from the Activity sheet and place it into column O in the Leg Miles sheet.

This is the current formula I have:
=INDEX(Activity!O:O,MATCH(0,Activity!F:F=$F2)*(Activity!E:E=$E2)*(Activity!L:L=$L2)*(Activity!M:M=$M2),0)

And this is a snapshot of what the current Leg Miles sheet looks like
<TABLE style="WIDTH: 932pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=1240 x:str><COLGROUP><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2413" width=66><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2450" width=67><COL style="WIDTH: 115pt; mso-width-source: userset; mso-width-alt: 5595" width=153><COL style="WIDTH: 46pt; mso-width-source: userset; mso-width-alt: 2230" width=61><COL style="WIDTH: 47pt; mso-width-source: userset; mso-width-alt: 2304" width=63><COL style="WIDTH: 62pt; mso-width-source: userset; mso-width-alt: 2998" span=2 width=82><COL style="WIDTH: 38pt; mso-width-source: userset; mso-width-alt: 1865" width=51><COL style="WIDTH: 108pt; mso-width-source: userset; mso-width-alt: 5266" width=144><COL style="WIDTH: 85pt; mso-width-source: userset; mso-width-alt: 4132" width=113><COL style="WIDTH: 31pt; mso-width-source: userset; mso-width-alt: 1499" width=41><COL style="WIDTH: 44pt; mso-width-source: userset; mso-width-alt: 2157" width=59><COL style="WIDTH: 53pt; mso-width-source: userset; mso-width-alt: 2560" width=70><COL style="WIDTH: 93pt; mso-width-source: userset; mso-width-alt: 4534" width=124><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966 1pt solid; BACKGROUND-COLOR: #339966; WIDTH: 50pt; HEIGHT: 13.5pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 height=18 width=66><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape style="Z-INDEX: 1; POSITION: absolute; MARGIN-TOP: 0px; WIDTH: 3.75pt; HEIGHT: 3.75pt; VISIBILITY: visible; MARGIN-LEFT: 0px" id=Picture_x0020_1 alt="C:\Documents and Settings\eblair\Local Settings\Temporary Internet Files\Content.IE5\BOAC8W1G\rs.aspx?image=1.gif" type="#_x0000_t75" o:spid="_x0000_s1025"><v:imagedata src="file:///C:\Documents%20and%20Settings\eblair\Local%20Settings\Temporary%20Internet%20Files\Content.IE5\BOAC8W1G\rs.aspx%3fimage=1.gif"></v:imagedata><?xml:namespace prefix = x ns = "urn:schemas-microsoft-com:office:excel" /><x:ClientData ObjectType="Pict"><x:SizeWithCells></x:SizeWithCells></x:ClientData></v:shape>Org Name</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 50pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=67>Vehicle ID</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 115pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=153>Driver Name</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 46pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=61>Driver ID</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 47pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=63>Route ID</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 62pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=82>Start Time</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 62pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=82>End Time</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 38pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=51>Site ID</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 108pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=144>Site Name</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 85pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=113>City</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 31pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=41>State</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 44pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=59>Latitude</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 53pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=70>Longitude</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: #339966; WIDTH: 93pt; BORDER-TOP: #339966 1pt solid; BORDER-RIGHT: #339966 1pt solid" class=xl63 width=124>Sum(Leg Distance)</TD><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8" width=64>Activity</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966 1pt solid; BACKGROUND-COLOR: silver; WIDTH: 50pt; HEIGHT: 13.5pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 height=18 width=66>XXX</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 50pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=67>1234567</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 115pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=153>Smith, John</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 46pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=61 align=right x:num>3333333</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 47pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=63 align=right x:num>121212</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 62pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl68 width=82 align=right x:num="40756.813888888886">8/1/2011</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 62pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl68 width=82 align=right x:num="40756.840277777781">8/1/2011</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 38pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=51>123</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 108pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=144>SITE NAME</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 85pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=113>City</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 31pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl67 width=41>US</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 44pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl69 width=59 x:num>12345678</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 53pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl69 width=70 x:num>-98765432</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: silver; WIDTH: 93pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl69 width=124 x:num>0</TD><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8" align=middle x:err="#N/A">VLOOKUP</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966 1pt solid; BACKGROUND-COLOR: white; WIDTH: 50pt; HEIGHT: 13.5pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 height=18 width=66>XXX</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 50pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=67>1234567</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 115pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=153>Smith, John</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 46pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=61 align=right x:num>3333333</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 47pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=63 align=right x:num>121212</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 62pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl65 width=82 align=right x:num="40756.861805555556">8/1/2011</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 62pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl65 width=82 align=right x:num="40756.919444444444">8/1/2011</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 38pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=51 align=right x:num>456</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 108pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=144>SITE NAME 2</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 85pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=113>City 2</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 31pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl64 width=41>US</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 44pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl66 width=59 x:num>12345679</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 53pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl66 width=70 x:num>-98765431</TD><TD style="BORDER-BOTTOM: #339966 1pt solid; BORDER-LEFT: #339966; BACKGROUND-COLOR: white; WIDTH: 93pt; BORDER-TOP: #339966; BORDER-RIGHT: #339966 1pt solid" class=xl66 width=124 x:num>21.6</TD><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8" align=middle x:err="#N/A">VLOOKUP</TD></TR></TBODY></TABLE>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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