Selecting right appointment

thesuggs76

Board Regular
Joined
Nov 15, 2006
Messages
247
Hi All
I'm trying to work a query that will allow me to select the outcome of an appointment that has taken place within a certain timeframe. The outcome would be either Attended or DNA. However the problem I have is that an individual can have more that one appointment within this timeframe, several in fact. They could have 6 appointments, the first 5 were DNA'd then the 6th would be attended. And others will only have one appointment and the outcome could be either Attended or DNA.
I need to count the Attended for the first example i mentioned but not to count the DNA as I only want to count DNA for that individual if they have not attended any appointments.
The table I'm using is called Appointments.

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try setting up a calculated expression that returns 1 for Attended and 0 for DNA.
Then you can query, grouping by client and date range and taking the Max of the calculated field. Max=0 will show someone who never attended.

Denis
 
Upvote 0
Try setting up a calculated expression that returns 1 for Attended and 0 for DNA.
Then you can query, grouping by client and date range and taking the Max of the calculated field. Max=0 will show someone who never attended.

Denis

Hi, thanks for replying. I've included what the data looks like below. For example I'm looking for all those that attended and did not attend an appointment. As you can see ID 1, although they DNA'd 2 appointments still attended the last. I don't need his DNA to count. If I do as you suggest would it still not count his first DNA

ID Appointment Status
1 01/01/13 DNA
1 02/01/13 DNA
1 03/01/13 Attended
2 04/01/13 Attended
3 04/01/13 DNA
 
Upvote 0
No, that's why I used MAX. 1 is bigger than 0, so DNA won't appear in the grouped total.

Denis
 
Upvote 0
No, that's why I used MAX. 1 is bigger than 0, so DNA won't appear in the grouped total.

Denis

Thanks for replying. It's working out those that DNA I'm finding hard to work out. Unlike the Attend, with DNA I need to ignore any individual who has attended an appointment. An individual may have 5 appointments, DNA'd the first 4 but attended the 5th. I don't want to include him I only want those where they have DNA'd every appointment within this time period
 
Upvote 0
If you don't display the date (you can filter by dates to get the desired date range) and then group by the ID and use the MAX of the calculated field I described, you'll get the result: ID, Score (0 or 1).
Save the query and join to a dummy table with 2 fields; Score (values: 0 or 1) and Status (values: DNA or Attended).
Display the ID and the Status.

sometimes, one query doesn't do the job completely...

Denis
 
Upvote 0
If you don't display the date (you can filter by dates to get the desired date range) and then group by the ID and use the MAX of the calculated field I described, you'll get the result: ID, Score (0 or 1).
Save the query and join to a dummy table with 2 fields; Score (values: 0 or 1) and Status (values: DNA or Attended).
Display the ID and the Status.

sometimes, one query doesn't do the job completely...

Denis

Thanks Dennis
 
Upvote 0

Forum statistics

Threads
1,202,990
Messages
6,052,947
Members
444,620
Latest member
marialewis16

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