Help with a formula please

kralin

New Member
Joined
Dec 8, 2023
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hello

I am using version 2019.

Hello - I would be very grateful for help with a formula please.
Please see sample dataset (image, hopefully is clear).

I need the formula to look at each individual ID and then to return a 'Y' in the row of the Alert with the most recent date (column D) if the ID has had:

either two or more successive instances of 'Did not attend'

Or two or more successive instances of 'did not attend' and 'cancelled' (or variations)

Or two or more successive instances of 'cancelled' and 'cancelled' (or variations)

Or any variation of 'did not attend' or 'cancelled' as long as there are two or more



following an instance of 'attended on time' - and additionally, if there is no 'to be attended' set at a future date.

In the attached example:

ID 1 has not attended but because they have a future date they don't need an alert

ID 2 needs an alert as they have had two instances of 'did not attend' or 'cancelled' since attending.

ID 3 has had two cancellations but has attended since then and so doesn't need an alert.

ID4 has only had cancellations so needs an alert

ID 5 has had a variety of cancellations since attending so would need an alert.


Please note this is sample data in real life the spreadsheet is many 1000s of rows long, so any formula would need to be robust enough to handle a lot of data.

I would only need to see 'Y' or 'N' on the row with the most recent date. Many thanks.
 

Attachments

  • no atts image.JPG
    no atts image.JPG
    52 KB · Views: 11

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
To boil down your requirements, it seems that if the 2 most recent entries are "Cancelled" or "Did not attend", then you want an alert. This is easy to do since the dates appear to be in descending order. (There is an exception on rows 15 and 16. If that can actually happen, the formula will need to be revised.) Try:

Book2
ABCD
1IDDateAttendance?Alert
2114-Feb-24to be AttendedN
3121-Nov-23Did not attend 
4121-Nov-23Did not attend 
5114-Nov-23Attended 
6221-Nov-23Did not attendY
7221-Oct-23Cancelled 
8214-Sep-23Attended 
9312-Nov-23CancelledN
10312-Oct-23Attended 
11312-Sep-23Did not attend 
12312-Aug-23Cancelled 
1341-Feb-23CancelledY
1443-Mar-23Cancelled 
1543-Apr-23Did not attend 
1644-Apr-23Cancelled 
1754-Apr-23Did not attendY
1853-Mar-23Cancelled 
1952-Feb-23Cancelled 
20522-Jan-23Did not attend 
2151-Jan-23Attended 
Sheet5
Cell Formulas
RangeFormula
D2:D21D2=IF(A2=A1,"",IF(A2<>A3,"",IF(SUM(COUNTIF(C2:C3,{"Did not*","Can*"}))=2,"Y","N")))
 
Upvote 0
To boil down your requirements, it seems that if the 2 most recent entries are "Cancelled" or "Did not attend", then you want an alert. This is easy to do since the dates appear to be in descending order. (There is an exception on rows 15 and 16. If that can actually happen, the formula will need to be revised.) Try:

Book2
ABCD
1IDDateAttendance?Alert
2114-Feb-24to be AttendedN
3121-Nov-23Did not attend 
4121-Nov-23Did not attend 
5114-Nov-23Attended 
6221-Nov-23Did not attendY
7221-Oct-23Cancelled 
8214-Sep-23Attended 
9312-Nov-23CancelledN
10312-Oct-23Attended 
11312-Sep-23Did not attend 
12312-Aug-23Cancelled 
1341-Feb-23CancelledY
1443-Mar-23Cancelled 
1543-Apr-23Did not attend 
1644-Apr-23Cancelled 
1754-Apr-23Did not attendY
1853-Mar-23Cancelled 
1952-Feb-23Cancelled 
20522-Jan-23Did not attend 
2151-Jan-23Attended 
Sheet5
Cell Formulas
RangeFormula
D2:D21D2=IF(A2=A1,"",IF(A2<>A3,"",IF(SUM(COUNTIF(C2:C3,{"Did not*","Can*"}))=2,"Y","N")))
Thanks for taking the time and trouble to get back to me. What you suggested has worked.
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,069
Members
449,092
Latest member
ipruravindra

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