# Report to capture patients with certain lab tests

I am trying to write a report to capture only the patients that had certain lab tests done. So for example I need everyone that had test A and they also had tests B,C,D. If I just use the in function of in [A,B,C,D] then I get everyone that had one those tests not the patients that had A and B,C or D. What is the best way to write this in Crystal Reports ?

##### Add a comment
10|10000 characters needed characters exceeded

### Related questions

• Posted on Mar 31, 2017 at 11:06 PM

Hi Curt,

Using the In function is the same a using an OR comparison. If you use AND then you could potentially give you partial returns as well.

Have the report get all patients that have Exam A, B, C and D.

Create a group on patient.

Suppress the groups that don't contain Exam A, B, C, and D. Now it's a matter of how to determine if all 4 exams were done. One way to do this is to create a formula like:

```If {table.EXAM} In ["A", "B", "C", "D"] Then
1
Else 0; ```
Drop this formula into the Detail section.

Now you can do a Sum on this formula and drop the summary into the Group Footer.

Create a Group Selection Formula where the formula >= 4.

So it should only list patients that have had all 4 exams.

Good luck,

Brian

##### Add a comment
10|10000 characters needed characters exceeded
• Posted on Apr 03, 2017 at 04:01 PM

Brian - I put all of the exams in the report using an 'in' statement. Some patients only have one of the exams, etc....In your post it says to suppress the groups that don't have exam A,B,C,D, How do I suppress those ?

##### Add a comment
10|10000 characters needed characters exceeded