Complex Index(Match) Problem

Nlhicks

Board Regular
Joined
Jan 8, 2021
Messages
244
Office Version
  1. 365
Platform
  1. Windows
This function works to get me the value I need for this instance however, when I change E3 and E4 to new values I get an error.
=INDEX('Facility Ratings & SOLs (Lines)'!$B$2:$B$685,MATCH(1,('Update Spreadsheet'!E3='Facility Ratings & SOLs (Lines)'!$J$2:$J$685)*('Update Spreadsheet'!E4='Facility Ratings & SOLs (Lines)'!$K$2:$K$685),0)

I am trying to turn this into VBA code that will do the same thing as the formula except allow for finding any of the values that match and returning the right value with this code:

Sub IndexMatchSubs()

Dim aSheet As Worksheet
Dim iSheet As Worksheet

Set aSheet = Worksheets("Update Spreadsheet")
Set iSheet = Worksheets("Facility Ratings & SOLs (Lines)")

aSheet.Range("E7").Value = Application.WorksheetFunction.Index(iSheet.Range("B2:B685"), Application.WorksheetFunction.Match(1, aSheet.Range("E3"), iSheet.Range("J2:J685"), 0) * Application.WorksheetFunction.Match(aSheet.Range("E4"), iSheet.Range("K2:K685"), 0))

End Sub

Any Ideas
 

Attachments

  • Worksheet I am drawing from.PNG
    Worksheet I am drawing from.PNG
    63.4 KB · Views: 18
  • worksheet I am gathering information for.PNG
    worksheet I am gathering information for.PNG
    13.3 KB · Views: 18

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
What about if you split MATCH function?

Excel Formula:
=INDEX('Facility Ratings & SOLs (Lines)'!$B$2:$B$685,MATCH(1,'Update Spreadsheet'!E3='Facility Ratings & SOLs (Lines)'!$J$2:$J$685, 0)*MATCH(1, 'Update Spreadsheet'!E4='Facility Ratings & SOLs (Lines)'!$K$2:$K$685, 0),0)
 
Upvote 0
Solution
What about if you split MATCH function?

Excel Formula:
=INDEX('Facility Ratings & SOLs (Lines)'!$B$2:$B$685,MATCH(1,'Update Spreadsheet'!E3='Facility Ratings & SOLs (Lines)'!$J$2:$J$685, 0)*MATCH(1, 'Update Spreadsheet'!E4='Facility Ratings & SOLs (Lines)'!$K$2:$K$685, 0),0)
Thank you this is very helpful
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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