Index match gives errors

denmccue

New Member
Joined
Dec 7, 2022
Messages
7
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I am trying to write straightforward code, using web searches to pattern my line.
Cells("H2").Value = WorksheetFunction.Index(Range("P2:P284"), WorksheetFunction.Match(Cells("E2").Value, Range("O2:O284"), 0))
where H2 is the target answer here cell, P2:P284 will have the answer somewhere in that range, E2 is the cell to be matched, and O2:O284 is the range to match E2 to.
I get Run-time Error "5": Invalid procedure or call
Thanks for helping!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You will want to tweak the Address(True/False,True/False) to lock the ranges appropriately.

Here you go:

Range("H2") = "=Index(" & Range("P2:P284").Address(False, False) & " , Match(" & Range("E2").Address(True, False) & " ," & Range("O2:O284").Address(True, True) & ", 0))"
 
Upvote 0
Hi & welcome to MrExcel.
Change both the Cells to Range.
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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