I am trying to do an index match with the index looking in column B (Date) and the match is to find a works order number (eg example 1, example 2) from a separate sheet and match to the tab screen shown below.
Here is a copy of the table range I am trying to gather a match from
In my head it would look like so =INDEX(B:B,MATCH("A1",E2:BP200,0)), however it wont look across all the range to find a match.
I have a formula that technically works which is "=@IFNA(IFS(ISNUMBER(MATCH([@Batch],'Production Plan':E,E,0)):INDEX('Production Plan',B,B:MATCH([@Batch],'Production Plan'.EE0))"...repeated for each column. However this makes the calculations incredibly slow.
Any help would be hugely appreciated.
One solution could be to create a VBA function using "range.find", where "range" is your E:BP area.
So you could make the function below, to return the row number where it finds the first match to your order number. The way the function is written, it would return the row number within the entire worksheet (eg it should tell you "5" if you look for "Example 1"). It is also set up to return -1 if there is an error or it can't find your search term, so you might want to make better error handling.
So my suggested use here would be INDEX(B:B,rowmatch_exact("A1",E1:BP200,"columns")) or INDEX(B:B,rowmatch_exact("A1",E1:BP200,"rows")).
Function rowmatch_exact(sought As Variant, range As range, searchdirection As String) As Integer
On Error GoTo ErrorDone
If searchdirection = "columns" Then
rowmatch_exact = range.Find(what:=sought, searchorder:=xlByColumns, LookIn:=xlValues, lookat:=xlWhole).Row
ElseIf searchdirection = "rows" Then
rowmatch_exact = range.Find(what:=sought, searchorder:=xlByRows, LookIn:=xlValues, lookat:=xlWhole).Row
Else
GoTo ErrorDone
End If
GoTo Done:
ErrorDone:
rowmatch_exact = -1
Done:
End Function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.