Multiple Conditions with INDEX

jmacritz

New Member
Joined
May 9, 2019
Messages
10
I have a table on one sheet called BOOKINGS that has information for who booked a room, what room they booked, the date and what resources they need. I can look up and display every entry for a particular room easily enough but what I'd like to do is to display only the entries for that room within the next two weeks. An example of my table

On a different sheet I'd like have the user input the room name (say in cell b2) and have it display Booked By, Date, Resources for anything matching the room name and within the next two weeks

Any help would be appreciated

<tbody>
[TD="class: xl66"]
[TABLE="width: 500"]
<tbody>[TR]
[TD]Booked By
RoomDateResources
TimOak9-may-19Projector
TonyPine7-may-19Fold Out
MikePine15-may-19Laptop
TimElm10-may-19Sci Equip
LucyElm13-may-19Projector
LucyOak14-may-19Laptop
MikeWillow5-may1-9Fold Out
SandraPine22-may-19Projector
VictoriaWillow28-may-19Projector

<tbody>
</tbody>
[/TD]

</tbody>
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi & welcome to MrExcel.
How about


Excel 2013/2016
BCDE
2PineMike15/05/2019Laptop
3Sandra22/05/2019Projector
Sheet2
Cell Formulas
RangeFormula
C2=IFERROR(INDEX(Sheet1!$A$2:$A$10,AGGREGATE(15,6,((ROW(Sheet1!$B$2:$B$10)-ROW(Sheet1!$B$2)+1))/((Sheet1!$B$2:$B$10=$B$2)*(Sheet1!$C$2:$C$10<=TODAY()+14)*(Sheet1!$C$2:$C$10>=TODAY())),ROWS($A$1:A1))),"")
D2=IFERROR(INDEX(Sheet1!C$2:C$10,AGGREGATE(15,6,((ROW(Sheet1!$B$2:$B$10)-ROW(Sheet1!$B$2)+1))/((Sheet1!$B$2:$B$10=$B$2)*(Sheet1!$C$2:$C$10<=TODAY()+14)*(Sheet1!$C$2:$C$10>=TODAY())),ROWS($A$1:B1))),"")
E2=IFERROR(INDEX(Sheet1!D$2:D$10,AGGREGATE(15,6,((ROW(Sheet1!$B$2:$B$10)-ROW(Sheet1!$B$2)+1))/((Sheet1!$B$2:$B$10=$B$2)*(Sheet1!$C$2:$C$10<=TODAY()+14)*(Sheet1!$C$2:$C$10>=TODAY())),ROWS($A$1:C1))),"")
 
Upvote 0
Thanks for the quick reply. I can follow most of the formula but I'm not familiar with the AGGREGATE function. I'll give it a try and see how it works out for me.
Currently what I'm using to display all the data on a given room is

=IFERROR(INDEX('BOOKINGS'!$A$2:$D$10, SMALL(IF(($B$2='BOOKINGS'!$B$2:$B$10), ROW('BOOKINGS'!$B$2:$B$10)-MIN(ROW('BOOKINGS'!$B$2:$B$10))+1," "),ROW('BOOKINGS'!A1)),COLUMN('BOOKINGS'!A1)),"")
 
Upvote 0
Since I can't edit my post - I looked up the AGGREGATE function and correct me if I'm wrong but with the setting of 15,6 its basically doing the same thing as my SMALL function and ignoring the errors, correct?
 
Upvote 0
That's right, but using Aggregate means it's a "normal" formula, rather than an Array formula
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
When I used the formula on my actual table, it displays the first row perfectly fine, but everything else is blank. The only difference is the range (from 10 to 59, which I changed) and the sheet name I changed it to my table (Sheet1 to 'BOOKINGS') can I not reference the table with this?
 
Upvote 0
Is Bookings the sheet name, or the name of a table?
Also could you post one of the modified formulae?
 
Upvote 0
I renamed the Sheet to Booking Data. The range changed from 2:10 to 2:59.
=IFERROR(INDEX('Booking Data'!$A$2:$A$59,AGGREGATE(15,6,((ROW('Booking Data'!$B$2:$B$59)-ROW('Booking Data'!$B$2)+1))/(('Booking Data'!$B$2:$B$59=$B$2)*('Booking Data'!$C$2:$C$59<=TODAY()+14)*('Booking Data'!$C$2:$C$59>=TODAY())),ROWS($A$1:A1))),"")

The first record shows without a problem but every other record is blank.
 
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