Application.Match yielding "Type Mismatch"

wadevcamp

New Member
Joined
Jul 18, 2012
Messages
16
The following code results in a 'type mismatch" when trying to calculate 'i' in both cases. The range wrng2 is depicted below, and the values are Date type.

1576183367949.png


VBA Code:
Dim i As Integer
Dim d As Date
    d = #8/4/2019#
    i = Application.Match(d, Range("wrng2").Value, -1)
    d = Range("wrng2").Cells(7, 1).Value
    i = Application.Match(d, Range("wrng2").Value, -1)

Any help would be much appreciated.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I'm sorry, you had sent message #19 and I didn't see it.
I hope it works for what you need. Let me know any questions.
 
Upvote 0
@wadevcamp
For future reference
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

 
Upvote 0
Apologies for the breach of protocol re: cross-posting -- now I know.

The answers on another forum added that one must also use '.value2' as the property (instead of '.value') of the range being searched in the MATCH function -- THIS additional modification makes it work. Thanks to all -- too bad this issue isn't more widely understood (or documented!).
 
Upvote 0
Unfortunately, not all excel options are documentary, for that there are forums, to leave traces and examples of what you find on the long road to Excel.
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

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