Match/Index Function with AND/OR

dman78

New Member
Joined
Oct 22, 2016
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
want an output in G2 that inputs "Peter / Scheduled" based on whether the time in Column C is "Full Day" or "AM" based on an index/match that uses an OR variable.

So if Peter is scheduled for AM or FULL DAY, I want it to be shown in G2 and if he is scheduled for the afternoon I want G4 to be populated.

I have the formula for
G4, nut not for G2 where it involves an OR Match. I get an #NA error. Also Each Date has ONLY three options: AM, PM, FULLDAY.

The forumula for G4 {=INDEX(A2:D6,MATCH(1,(A2:A6="PETER")*(B2:B6=H1)*(C2:C6="PM"),0),4)} which WORKS!

I just need to know how to complete G2

Thank you Kindly!


A​
B​
C​
D​
E​
F​
G​
H​
1​
StaffDateTimeResultPeter TimeApril 14April 15
2​
MikeApril 1AMMike / ScheduledAM or Full Day#NA#NA
3​
SallyApril 14PMSally / Scheduled
4​
PeterApril 14PMPeter / ScheduledPMPeter / ScheduledPeter / Scheduled
5​
Peter
April 14
Full DayPeter / Scheduled
6​
PeterApril 15PM
Peter / Scheduled
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Done!
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Office 2016
 
Upvote 0
Thanks for that.
How about
Excel Formula:
=INDEX(A2:D6,MATCH(1,(A2:A6="PETER")*(B2:B6=H1)*((C2:C6="AM")+(C2:C6="Full day")),0),4)
 
Upvote 0
The "and" condition you found works with multiply.
An "or" condition works with addition.

Book1
ABCDEFGH
1StaffDateTimeResultPeter Time14-Apr15-Apr
2Mike1-AprAMMike / ScheduledAM or Full DayPeter / Scheduled#N/A
3Sally14-AprPMSally / Scheduled
4Peter14-AprPMPeter / ScheduledPMPeter / ScheduledPeter / Scheduled
5Peter14-AprFull DayPeter / Scheduled
6Peter15-AprPMPeter / Scheduled
Sheet1
Cell Formulas
RangeFormula
G2:H2G2=INDEX($A$2:$D$6,MATCH(1,($A$2:$A$6="PETER")*($B$2:$B$6=G1)*(($C$2:$C$6="AM")+($C$2:$C$6="Full Day")),0),4)
G4:H4G4=INDEX($A$2:$D$6,MATCH(1,($A$2:$A$6="PETER")*($B$2:$B$6=G1)*($C$2:$C$6="PM"),0),4)
 
Upvote 0
Solution
Thanks for that.
How about
Excel Formula:
=INDEX(A2:D6,MATCH(1,(A2:A6="PETER")*(B2:B6=H1)*((C2:C6="AM")+(C2:C6="Full day")),0),4)
The "and" condition you found works with multiply.
An "or" condition works with addition.

Book1
ABCDEFGH
1StaffDateTimeResultPeter Time14-Apr15-Apr
2Mike1-AprAMMike / ScheduledAM or Full DayPeter / Scheduled#N/A
3Sally14-AprPMSally / Scheduled
4Peter14-AprPMPeter / ScheduledPMPeter / ScheduledPeter / Scheduled
5Peter14-AprFull DayPeter / Scheduled
6Peter15-AprPMPeter / Scheduled
Sheet1
Cell Formulas
RangeFormula
G2:H2G2=INDEX($A$2:$D$6,MATCH(1,($A$2:$A$6="PETER")*($B$2:$B$6=G1)*(($C$2:$C$6="AM")+($C$2:$C$6="Full Day")),0),4)
G4:H4G4=INDEX($A$2:$D$6,MATCH(1,($A$2:$A$6="PETER")*($B$2:$B$6=G1)*($C$2:$C$6="PM"),0),4)

THANK YOU BOTH SO MUCH! I have spent the last two days pulling my hair out trying to resolve this! Thanks, this will make my work so much easier! :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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