IF, OR, Index, Match, Multiple Criteria

wintye

New Member
Joined
Apr 15, 2013
Messages
15
Hi All,

I hope you're enjoying the weekend.

I wonder if anyone can help with the following formula. I'm trying to pull a date from another table but only if it matches certain criteria.

Table with Data
Unique IdentifierFirst NameLast NameCourseDateGrade
12345JaneDoeCourse 115/04/20163
12345JaneDoeCourse 217/05/20173
12345JaneDoeCourse 319/01/20183
34567JohnSmithCourse 210/07/20175
34567JohnSmithCourse 325/06/20175
34567JohnSmithCourse 128/10/20165
78901JaneSmithCourse 301/01/20164
78901JaneSmithCourse 201/10/20174
78901JaneSmithCourse 101/05/20154
JohnDoeCourse 229/03/20157
JohnDoeCourse 123/10/20177
JohnDoeCourse 316/03/20167

<tbody>
</tbody>

Table pulling data into

Last NameFirst NameUnique IdentifierCourse 1Course 2Course 3
VLOOKUP from another tableVLOOKUP from another tableVLOOKUP from another tableto include the formulato include the formulato include the formula

<tbody>
</tbody>

The formula I have so far is:

{=IF(C2="","",IF(OR(Data_Report[Grade]="3",Data_Report[Grade]="4"),INDEX(Data_Report[Date],MATCH(1,(Data_Report[Unique Identifier]=C2)*(Data_Report[Course]="1"),0)),"Not Applicable"))}

Basically I'd like the formula to show if there's nothing in the "unique Identifier" column then to leave the cell empty,
If there is a "unique Identifier" in cell 'C2' then to lookup the unique identifier to the data table ensuring to match the grade to either a grade 3 or 4 and additionally match the the course name and pulling through the date the course was completed.
If the grade is different to 3 or 4 then to return 'not applicable'

e.g. = Jane Doe, Course 2 should show as '17/05/2017'
John Smith, Course 3 should show as 'Not Applicable'
Jane Smith, Course 1 should show as '01/05/2015'
John Doe, Course 1 should show as a blank cell

Hoping the above makes sense and welcome any feedback and advise. I've spen forever trying to get it to work and am so close but haven't quite got it.

Many thanks in advance for reading
Wintye :confused::confused:
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
17/05/2017

<tbody>
</tbody>
</body>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Have a go with:

=IF(C2="","",IF(OR(INDEX(Data_Report[Grade],MATCH(1,INDEX((Data_Report[Unique Identifier]=C2)*(Data_Report[Course]=D$1),0),0))={3,4}),INDEX(Data_Report[Date],MATCH(1,INDEX((Data_Report[Unique Identifier]=C2)*(Data_Report[Course]=D$1),0),0)),"Not Applicable"))
 
Upvote 0
Maybe the Array Formula (use Ctrl+Shift+Enter to enter the formula) below:

In D2 and copy down and to the right:

=IF($C2="","",IFERROR(LOOKUP(1,1/((Data_Report[Unique Identifier]=$C2)*
((Data_Report[Grade]=3)+(Data_Report[Grade]=4))*(Data_Report[Course]=D$1)),Data_Report[Date]),"Not Applicable"))

Markmzz
 
Upvote 0
.. yet another slight variation.
The formula in D2 must be Copy/Pasted (not dragged) across to E2:F2 before being copied (or dragged) down.
[An alternative is to enter my D2 formula as an array formula - as markmzz did with his - which could then be dragged across & down but the array entry makes my formula somewhat slower to calculate]

Excel Workbook
ABCDEF
1Last NameFirst NameUnique IdCourse 1Course 2Course 3
2SmithJane789011/05/20151/10/20171/01/2016
3DoeJane1234515/04/201617/05/201719/01/2018
4DoeJohn
5SmithJohn34567Not ApplicableNot ApplicableNot Applicable
6
7
8Unique IdentifierFirst NameLast NameCourseDateGrade
912345JaneDoeCourse 115/04/20163
1012345JaneDoeCourse 217/05/20173
1112345JaneDoeCourse 319/01/20183
1234567JohnSmithCourse 210/07/20175
1334567JohnSmithCourse 325/06/20175
1434567JohnSmithCourse 128/10/20165
1578901JaneSmithCourse 31/01/20164
1678901JaneSmithCourse 21/10/20174
1778901JaneSmithCourse 11/05/20153
18JohnDoeCourse 229/03/20157
19JohnDoeCourse 123/10/20177
20JohnDoeCourse 316/03/20167
21
Course Date
 
Upvote 0
Maybe the Array Formula (use Ctrl+Shift+Enter to enter the formula) below:

In D2 and copy down and to the right:

=IF($C2="","",IFERROR(LOOKUP(1,1/((Data_Report[Unique Identifier]=$C2)*
((Data_Report[Grade]=3)+(Data_Report[Grade]=4))*(Data_Report[Course]=D$1)),Data_Report[Date]),"Not Applicable"))

Markmzz

Thank you all so much for your help.

Markmzz - Yours works very well.

However I also need for it to tell me if a grade 3 or 4 hasn't completed the course.

At the moment if their unique identifier isn't showing on the report (which it won't as not completed) for that particular course (course 3 for example) then at the moment it just goes straight to "Not Applicable" and I need to to say "Due". I do have a another sheet with all unique identifiers listed with grade.

Is there a way this can also be incorporated?

Thank you so much for your help so far, It's really appreciated

Wintye
 
Upvote 0
Markmzz - Yours works very well.

However I also need for it to tell me if a grade 3 or 4 hasn't completed the course.

At the moment if their unique identifier isn't showing on the report (which it won't as not completed) for that particular course (course 3 for example) then at the moment it just goes straight to "Not Applicable" and I need to to say "Due". I do have a another sheet with all unique identifiers listed with grade.

Is there a way this can also be incorporated?

Thank you so much for your help so far, It's really appreciated

Wintye

Hi Wintye,

I'm sorry, but I didn't understand what you want.

Could you put an example (like placed in your post #01) in your next post? With more details (what you have and what you want).

Markmzz
 
Last edited:
Upvote 0

Hi Wintye,

I'm sorry, but I didn't understand what you want.

Could you put an example (like placed in your post #01) in your next post? With more details (what you have and what you want).

Markmzz

Hi Markmzz,

Thanks so much for your reply.

At the moment I have a colleague that is grade 4 and pulled through on the report for two of the courses but not the final report due to it's not yet been completed. I need the formula to show that that person hasn't completed and is still due - due to being a grade 4.

Table with Data
Unique IdentifierFirst NameLast NameCourseDateGrade
12345JaneDoeCourse 115/04/20163
12345JaneDoeCourse 217/05/20173
34567JohnSmithCourse 210/07/20175
34567JohnSmithCourse 325/06/20175
34567JohnSmithCourse 128/10/20165
78901JaneSmithCourse 301/01/20164
78901JaneSmithCourse 201/10/20174
78901JaneSmithCourse 101/05/20154
JohnDoeCourse 229/03/20157
JohnDoeCourse 123/10/20177
JohnDoeCourse 316/03/20167

<tbody>
</tbody>

As you can see from the above table, Jane Doe is a grade 3 so needs to complete all three courses but is only showing on the data report as having completed course 1 & course 2. Course 3 won't show on this report until it's completed.

I need the formula (that's pulling this data from the data report into another sheet) to also advise that as that person is a grade 3 (or 4) and that course isn't listed then to show as due to show that it still needs to be completed.

Hopefully the above helps a little but let me know if not.

Many thanks
Wintye
 
Upvote 0
Hi Markmzz,

Thanks so much for your reply.

At the moment I have a colleague that is grade 4 and pulled through on the report for two of the courses but not the final report due to it's not yet been completed. I need the formula to show that that person hasn't completed and is still due - due to being a grade 4.

As you can see from the above table, Jane Doe is a grade 3 so needs to complete all three courses but is only showing on the data report as having completed course 1 & course 2. Course 3 won't show on this report until it's completed.

I need the formula (that's pulling this data from the data report into another sheet) to also advise that as that person is a grade 3 (or 4) and that course isn't listed then to show as due to show that it still needs to be completed.

Hopefully the above helps a little but let me know if not.

Many thanks
Wintye

Hi Wintye,

Do some tests with the Array Formula (use Ctrl+Shift+Enter to enter the formula) below and tell me if it works.

=IF($C2="","",IFERROR(LOOKUP(1,1/((Data_Report[Unique Identifier]=$C2)*
((Data_Report[Grade]=3)+(Data_Report[Grade]=4))*(Data_Report[Course]=D$1)),Data_Report[Date]),
IF(SUM((Data_Report[Unique Identifier]=$C2)*((Data_Report[Grade]=3)+(Data_Report[Grade]=4))),"Due","Not Applicable")))


Markmzz
 
Last edited:
Upvote 0
Hi All,

Me again. Thank you so much for your help previously.

My needs have changed a little since the above and I'm wondering if anyone could help?


Table:


Unique Identifier
First Name
Last Name
Grade
Status
Completed On
+ Years
Due
12345
Jane
Doe
5
Not Applicable
1
12346
John
Doe
5
Not Applicable
13/12/2017
1
13/12/2018
12347
Jane
Smith
7
Not Applicable
12/11/2017
1
23/11/2018
12348
John
Smith
4
Due
1
12349
Jane
Jones
5
Not Applicable
11/12/2017
1
11/12/2018
12334
John
Jones
4
Completed
14/12/2017
1
14/12/2018
12335
Jane
Doe
6
Not Applicable
02/01/2018
1
02/01/2019
12336
John
Doe
5
Not Applicable
29/09/2017
1
27/09/2018
12337
Jane
Smith
4
Completed
27/09/2017
1
27/09/2018
12338
John
Smith
3
Due
1

<tbody>
</tbody>


I need the formula inserted in the Status column to return the values as shown above.

I need this column to show as

"Not Applicable" if the grade is 5 or higher. (Some that are grade 5 or above have completed the course but I need it to ignore that and still show as not available.

"Due" if a Grade 3 or 4 doesn't have a date entered in the 'completed on' column
"Due in 2 wks" if the due column is today's date + 14
"Due in 4 wks" if the due column is today's date + 28
"Expired" if less than Today's Date
"Completed" if the date is within a year (less a month)

Any help would be greatly greatly appreciated.

Thank you in advance
Wintye
 
Upvote 0
Hi All,

Me again. Thank you so much for your help previously.

My needs have changed a little since the above and I'm wondering if anyone could help?


I need the formula inserted in the Status column to return the values as shown above.

I need this column to show as

"Not Applicable" if the grade is 5 or higher. (Some that are grade 5 or above have completed the course but I need it to ignore that and still show as not available.

"Due" if a Grade 3 or 4 doesn't have a date entered in the 'completed on' column
"Due in 2 wks" if the due column is today's date + 14
"Due in 4 wks" if the due column is today's date + 28
"Expired" if less than Today's Date
"Completed" if the date is within a year (less a month)

Any help would be greatly greatly appreciated.

Thank you in advance
Wintye

Hi Wintye!

If I understand correctly what you want now, maybe the suggestion below can help you:

In E2

=IF([@Grade]>4,"Not Applicable",
IF([@[Completed On]]="","Due",
LOOKUP(N([@Due])-TODAY(),{-2958465,"";-3650,"Expired";14,"Due in 2 wks";28,"Due in 4 wks";30,"Completed";366,""})))


ABCDEFGH
1Unique IdentifierFirst NameLast NameGradeStatusCompleted On+ YearsDue
212345JaneDoe5Not Applicable1
312346JohnDoe5Not Applicable13/12/2017113/12/2018
412347JaneSmith7Not Applicable12/11/2017123/11/2018
512348JohnSmith4Due1
612349JaneJones5Not Applicable11/12/2017111/12/2018
712334JohnJones4Completed14/12/2017114/12/2018
812335JaneDoe6Not Applicable02/01/2018102/01/2019
912336JohnDoe5Not Applicable29/09/2017127/09/2018
1012337JaneSmith4Completed27/09/2017127/09/2018
1112338JohnSmith3Due1
12
******************************************************************************************************

<tbody>
</tbody>

Markmzz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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