Complicated IF AND OR Statement help please

FaithH

New Member
Joined
Mar 3, 2014
Messages
13
I have a table that gives me a list of reasons why a lab cannot be reported on yet, and many times there are multiple reasons (we have a total of 19). The customer wants to know why we can't send them results yet so we send them a report with a reason, however we want to give them all of the reasons. So far, all I've managed to come up with is a long IF statement, but it only returns one of the reasons, not all of them if there are more than one. I want it to return all of the reasons, not just the one. Does anyone know how I can fix this? Thanks in advance for any help!


-- removed inline image ---


(AX2 cell here references the samples number and the reason(s) for it being on hold)

=IF(ISNUMBER(SEARCH("Reprep",Data!AX2)),"Reprep",IF(ISNUMBER(SEARCH("ICD",Data!AX2)),"Compliance-No ICD-9 Code",IF(ISNUMBER(SEARCH("DL",Data!AX2)),"DL Isomer Send Out",IF(ISNUMBER(SEARCH("Clerical",Data!AX2)),"Compliance-Requisition Verification",IF(ISNUMBER(SEARCH("Physician",Data!AX2)),"Compliance-No Requesting Physician",IF(ISNUMBER(SEARCH("RapidFire",Data!AX2)),"Additional Screening Required",IF(ISNUMBER(SEARCH("Screening",Data!AX2)),"Additional Screening Required",IF(ISNUMBER(SEARCH("Report",Data!AX2)),"Quick Report Requested",IF(ISNUMBER(SEARCH("PAF",Data!AX2)),"Compliance-No PAF",IF(ISNUMBER(SEARCH("Collection",Data!AX2)),"Compliance-No Collection Date",IF(ISNUMBER(SEARCH("Confirmation",Data!AX2)),"Compliance-Requisition Verification",IF(ISNUMBER(SEARCH("Sign",Data!AX2)),"Additional Screening Required",IF(ISNUMBER(SEARCH("Present",Data!AX2)),"Compliance-No Test Order Present","")))))))))))))

Accession #
Hold Description
All Reasons for Hold
OF14-94586
Additional Screening Required
Needs Screening^REPREP^D/L Isomer Send Out^Clerical Review Confirmation^Compliance - No Requesting Physician^Compliance - No Test Order Present^Compliance - No ICD-9 Code

<tbody>
</tbody>
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I would like for it to return the approved description that I've given it (2nd column here) and I want it to return all reasons, not just the first one that it comes across

AP Easy Hold Reason
Client TAT Report Hold Description
REPREPREPREP
D/L Isomer Send OutD/L Isomer Confirmation
Clerical Review ConfirmationCompliance - Requisition Verification
Compliance - No Requesting PhysicianCompliance - No Requesting Physician
Compliance - No Test Order PresentCompliance - No Test Order
Compliance - No ICD-9 CodeCompliance - No ICD-9 Code
Compliance - No Collection DateCompliance - No Collection Date
Needs Data Before Sign OutAdditional Screening Required
TCA ReprepREPREP
BARB ReprepREPREP
Needs ScreeningAdditional Screening Required
Test Order ConfirmationCompliance - Requisition Verification
Bath Salt REPREPREPREP
No PAF on fileCompliance - No PAF
RapidFire Panel 1Additional Screening Required
RapidFire Panel 2Additional Screening Required
RapidFire Panel 3Additional Screening Required
RapidFire Panel 4Additional Screening Required
Quick ReportQuick Report Requested

<tbody>
</tbody>
 
Last edited:
Upvote 0
Without code, the only way I've found is also with a long formula. If the reference table in your last post is in columns A and B, and the reasons for hold are in AX2 then you could try the following:


=SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Data!AX2,A2,B2),A3,B3),A4,B4),A5,B5),A6,B6),A7,B7),A8,B8),A9,B9),A10,B10),A11,B11),A12,B12),A13,B13),A14,B14),A15,B15),A16,B16),A17,B17),A18,B18),A19,B19),A20,B20),"^"," ")
 
Upvote 0
It appears to work, except that it pulls in reasons that we don't want the client to have. This is pulling in all reasons, and there are some reasons that legally we cannot give them. I need it to leave out reasons that aren't included in the list.
 
Upvote 0
OK. How many possible reasons are there ? If not too many more, then you could add them to column A in the reference table, with column B blank and adapt the formula for the extra number of rows.
 
Upvote 0
There's no formula way to concatenate all the results, you could use a UDF but would obviously required the use of VBA.


Excel 2010
ABC
1AP Easy Hold ReasonClient TAT Report Hold Description
2REPREPREPREP
3D/L Isomer Send OutD/L Isomer Confirmation
4Clerical Review ConfirmationCompliance - Requisition Verification
5Compliance - No Requesting PhysicianCompliance - No Requesting Physician
6Compliance - No Test Order PresentCompliance - No Test Order
7Compliance - No ICD-9 CodeCompliance - No ICD-9 Code
8Compliance - No Collection DateCompliance - No Collection Date
9Needs Data Before Sign OutAdditional Screening Required
10TCA ReprepREPREP
11BARB ReprepREPREP
12Needs ScreeningAdditional Screening Required
13Test Order ConfirmationCompliance - Requisition Verification
14Bath Salt REPREPREPREP
15No PAF on fileCompliance - No PAF
16RapidFire Panel 1Additional Screening Required
17RapidFire Panel 2Additional Screening Required
18RapidFire Panel 3Additional Screening Required
19RapidFire Panel 4Additional Screening Required
20Quick ReportQuick Report Requested
21
22
23
24
25
26
27
28
29Accession #Hold DescriptionAll Reasons for Hold
30OF14-94586Additional Screening RequiredNeeds Data Before Sign Out
31Needs Screening
32RapidFire Panel 1
33RapidFire Panel 2
34RapidFire Panel 3
35RapidFire Panel 4
Sheet1
Cell Formulas
RangeFormula
C30{=IF(ISERROR(INDEX($A$1:$B$20,SMALL(IF($B$1:$B$20=$B$30,ROW($B$1:$B$20)),ROW(1:1)),1)),"",INDEX($A$1:$B$20,SMALL(IF($B$1:$B$20=$B$30,ROW($B$1:$B$20)),ROW(1:1)),1))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Comfy - unfortunately I am a true beginner with Macros and VBA. I've only done a couple basic ones, and only 1 has worked :(

The All Reasons for Hold is on another tab within the workbook and is all in one line, separated by carets.

I'm trying to automate as much as I can since others will be using this spreadsheet to send reports.
 
Upvote 0
good luck faith. Also, you could change the "^"," " to "^",", " if you wanted the reasons comma-separated.
 
Upvote 0

Forum statistics

Threads
1,215,308
Messages
6,124,178
Members
449,146
Latest member
el_gazar

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