Index Match with multiple Criteria

Kellogg

New Member
Joined
Mar 30, 2013
Messages
41
Platform
  1. Windows
  2. MacOS
Dear Great Minds of Excel,

I have the following information:

Column A = Vehicle Numbers
Column D = Dates of Service
Column E = Type of Service

A D E
A111 01/22 Oil Change
A112 01/30 Brakes
A113 01/15 Wash
A111 01/18 Tires
A123 02/05 Oil Change


The following code will return the date 01/22.


Code:
Dim MYOil As Double
MYOil = Application.WorksheetFunction.Index(Worksheets("Activity_Log").Range("D:D") _
, Application.WorksheetFunction. _
  Match("Oil Change" _
, Worksheets("Activity_Log").Range("E:E") _
, 0), 0)
MsgBox MYOil


What I would like to do is add an additional match criteria to include the Vehicle Number. When I try this as written below I only receive errors.

Code:
Dim MYOil As Double
MYOil = Application.WorksheetFunction.Index(Worksheets("Activity_Log").Range("D:D") _
, Application.WorksheetFunction. _
  Match("Oil Change"[COLOR="#FF0000"] & "A123"[/COLOR] _
, Worksheets("Activity_Log").Range("E:E")[COLOR="#FF0000"] & Worksheets("Activity_Log").Range("A:A")[/COLOR] _
, 0), 0)
MsgBox MYOil

Any suggestions?

As always - Thanks


/s/


Craig
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try this...

Code:
[color=darkblue]Dim[/color] MYOil [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    
MYOil = Evaluate("INDEX(Activity_Log!D1:D10," & _
        "MATCH(1,(Activity_Log!E1:E10 = ""Oil Change"")*(Activity_Log!A1:A10=""A123""),0))")
[color=darkblue]If[/color] [color=darkblue]Not[/color] IsError(MYOil) [color=darkblue]Then[/color]
    MsgBox MYOil
[color=darkblue]Else[/color]
    MsgBox "No match found"
[color=darkblue]End[/color] [color=darkblue]If[/color]
 
Upvote 0

Forum statistics

Threads
1,216,769
Messages
6,132,604
Members
449,740
Latest member
tinkdrummer

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