Index with multiple match (Loop) when one of the Match is a Date ( VBA ) - Value Mismatch

xs4amit

New Member
Joined
May 21, 2018
Messages
34
Hi I am trying to do index match Loop through Columns first and then Rows with multiple criteria in VBA

My Source data is like:

Dateemail IDAttendance Status
22/08/18Bob22@tiptop.comPresent
22/08/18Milan@tiptop.comPresent
22/08/18Samuel@tiptop.comPresent
23/08/18Bob22@tiptop.comPlanned Leave
23/08/18Milan@tiptop.comPresent
23/08/18Samuel@tiptop.comPresent
24/08/18Bob22@tiptop.comPresent
24/08/18Milan@tiptop.comUnplanned Leave

<tbody>
</tbody>


And my Destination Data should be like this:

Email IDs22/08/1823/08/1824/08/18
Bob22@tiptop.Com
Milan@tiptop.com
Samuel@tiptop.com

<tbody>
</tbody>


Where as i am using Code with Worksheet function

With Destination
.Range("B2:D4").Clear
For R = 2 To 4
For C = 2 To UBound(Arr2, 2)

.Cells(R, C) = .Application.WorksheetFunction.Index(Source.Range("A2:C30000"), _
.Application.WorksheetFunction.Match(.Cells(R, 1) & CDate(.Cells(1, C)), WS1.Range("B2:B30000") & WS1.Range("A2:A30000"), 0), 3)


Next C


Next R
.Activate
End With


End Sub

it is giving me Type Mismatch Error. Any help??

I am using Excel 2016 on Mac.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,215,963
Messages
6,127,960
Members
449,412
Latest member
montand

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