3 IF statements for a cell??

locolindo

New Member
Joined
Dec 5, 2014
Messages
12
Hi There,
I have a table with hospital admission date (column A), discharge date (column B), and a third column that calculates the duration of stay (column C).
Sometimes, people forget to enter data for either the admission date (column A), or the discharge date (column B), or both (columns A & B)!!!
I would like to create a function for column C that does the following:

[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]Column A[/TD]
[TD="align: center"]Column B[/TD]
[TD="align: center"]Column C[/TD]
[/TR]
[TR]
[TD]Admission Date[/TD]
[TD]Discharge Date[/TD]
[TD]Lenght of Stay[/TD]
[/TR]
[TR]
[TD]NO DATA[/TD]
[TD]DATA[/TD]
[TD]"No Admission Date"[/TD]
[/TR]
[TR]
[TD]DATA[/TD]
[TD]NO DATA[/TD]
[TD]"Ongoing"[/TD]
[/TR]
[TR]
[TD]NO DATA[/TD]
[TD]NO DATA[/TD]
[TD]"No Data for Admission or Discharge"[/TD]
[/TR]
[TR]
[TD]DATA[/TD]
[TD]DATA[/TD]
[TD]Calculates B-A (easy!!!)[/TD]
[/TR]
</tbody>[/TABLE]

Can such a function be done all for one cell?
Thank you!!!
Locolindo
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi,

Using IF statements:


Book1
ABCD
1Admission DateDischarge DateLength of StayLength of Stay
26/1/2018No Admission DateNo Admission Date
35/15/2018OngoingOngoing
4No Data for Admission and DischargeNo Data for Admission and Discharge
55/15/20186/1/20181718
Sheet73
Cell Formulas
RangeFormula
C2=IF(AND(A2="",B2=""),"No Data for Admission and Discharge",IF(A2="","No Admission Date",IF(B2="","Ongoing",B2-A2)))
D2=IF(AND(A2="",B2=""),"No Data for Admission and Discharge",IF(A2="","No Admission Date",IF(B2="","Ongoing",B2-A2+1)))


If the length of stay should be Admission/Discharge Day Inclusive, use D2 formula, otherwise use C2 formula.

Either way, formula copied down.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,222
Messages
6,177,230
Members
452,765
Latest member
Erka Gizli

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