Match and inext multiple criteria

Kare1

New Member
Joined
Feb 13, 2017
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Im struggling with a formula, one match is an exact match the other is the closest less than. I can get the formular to work with the individual matches but I am struggling to get it to combine the 2 together, I end up wit the REF error

{=INDEX(B2:G30,MATCH("top",G2:G30,0),MATCH(B8,B2:B30,1),3)}

G2:G30 is a list of words (Top, Bottom) - This has to be an exact match
B8:B30 is a list of dates / Times eg 01/08/2017 12:50 - This has to be the closest before the date / time in Cell B8
3 is the cell I want it to return
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
This is a bit confused. Could you post the data? Make it so we can paste it back into excel.
 
Upvote 0
You are not using index correctly your match functions are returning row numbers but you are putting the second one into the column argument of index. There is no 4th argument where you have 3. Index returns the value from Array based on the row/column number.
=index(array,row number,[column number])

As Steve said it would help to see your data.
 
Upvote 0
Maybe take a guess at this:

=INDEX(D2:D30,MATCH(1,INDEX((G2:G30="top")*(B2:B30 < B8)*(B2:B30 <> ""),0),0))<b8)*(b2:b30<>

Not sure why one of your criteria is within its range to search though.</b8)*(b2:b30<>
 
Last edited:
Upvote 0
My data basically below, im wanting to be able to put in a date and time and return the result reel number. I can get this to work using index and match but I need to take into consideration top or bottom

eg on the 24th @ 15:40
Top reel number would be 3170867415
and bottom would be 3170812212
Start (Splice) Date & TimeDateReel numberGramageWeight (of Reel)Top Or Bottom Paper
23/08/2017 00:2923/08/201731708668251802394top
23/08/2017 02:5823/08/201731708627131902580Bottom
23/08/2017 04:5123/08/201731708682211802457top
23/08/2017 06:2023/08/201731708634241902519Bottom
23/08/2017 08:2523/08/201731707116231802421top
23/08/2017 09:3023/08/201731708634221902524Bottom
23/08/2017 11:5023/08/201731708677211802440top
23/08/2017 15:1823/08/201731708676131802438top
23/08/2017 15:2823/08/201731708116131902608Bottom
23/08/2017 18:5023/08/201731707117131802408top
23/08/2017 19:2123/08/201731708125211902574Bottom
23/08/2017 22:1723/08/201731707104211802452top
23/08/2017 22:4123/08/201731708125131902629Bottom
23/08/2017 22:4523/08/201731708633141902604Bottom
24/08/2017 01:4624/08/201731707112111802423top
24/08/2017 02:0524/08/201731708126231902566Bottom
24/08/2017 05:1524/08/201731708680141802439top
24/08/2017 05:2524/08/201731708125241902567Bottom
24/08/2017 08:5024/08/201731708680241802434top
24/08/2017 08:5024/08/201731708126141902628Bottom
24/08/2017 12:1524/08/201731708125111902638Bottom
24/08/2017 12:2024/08/201731708668241802408top
24/08/2017 15:3024/08/201731708674151802377top
24/08/2017 15:3524/08/201731708122121902606Bottom
24/08/2017 19:0024/08/201731708123131902623Bottom
24/08/2017 19:0324/08/201731708674111802397top
24/08/2017 22:3924/08/201731708124121902631Bottom
24/08/2017 22:4724/08/201731708674131802394top

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>

****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
3170867415

<tbody>
</tbody>
</body>
 
Upvote 0
As your date/times are in order this works:

=LOOKUP(2,1/((B2:B29< B8)*(G2:G29="top")),D2:D29)<b8)*(g2:g29="top")),d2:d29)< html=""></b8)*(g2:g29="top")),d2:d29)<>
 
Last edited:
Upvote 0
As your date/times are in order this works:

=LOOKUP(2,1/((B2:B29< B8)*(G2:G29="top")),D2:D29)<b8)*(g2:g29="top")),d2:d29)< html=""></b8)*(g2:g29="top")),d2:d29)<>

Wow it works, what do the 2 & 1 at the beginning mean?
 
Upvote 0
Code:
 =LOOKUP(2,[COLOR=#FF0000]1/((B2:B29< B8)*(G2:G29="top"))[/COLOR],D2:D29)
The 2 is the lookup value. The part in red is 1 divided by the criteria this gives you the 1 when the criteria is met and div/0 error when the criteria is not met.
Since the lookup value is larger then the numbers in the lookup vector and lookup only does approximant match it returns the last based on the last row that meets the criteria
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,289
Members
449,149
Latest member
mwdbActuary

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