Using IF,AND, with DATEDIF

AJWebb1

New Member
Joined
Feb 14, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am trying to get excel to do a calculation for me based on information below. If Column F is blank I want Excel to calculate LOS Years, LOS Months, LOS Days with start date Column A and today. If Column F is not blank like below then I want Excel to calculate LOS years, LOS months, LOS days from date in Column A and Column F. I'm just at a loss for how I need to write this, everything I've tried has not worked.

Admit Date-Column ALOS Years-Column BLOS Months-Column CLOS Days-Column DAssigned to-Column ECommunity Date- Column F
06/12/2201/03/24

my last try was =If(F2="", DATEDIF(A2,Today(),"Y")) then I do the same thing in the Month column and days column but its not giving me the answer I'm looking for.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Can you tell us what is the answer you are looking for? What is the calculation you are trying to get?
 
Upvote 0
As Coyotex mentioned there are a couple intepretations of this although you seem to be missing the 2nd part of your if statement.

Book1
ABCDEF
1Admit Date-Column ALOS Years-Column BLOS Months-Column CLOS Days-Column DAssigned to-Column ECommunity Date- Column F
26/12/202212241/03/2024
36/12/2022129
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=IF($F2="", DATEDIF($A2,TODAY(),"y"),DATEDIF($A2,$F2,"y"))
C2:C3C2=IF($F2="", DATEDIF($A2,TODAY(),"ym"),DATEDIF($A2,$F2,"ym"))
D2:D3D2=IF($F2="", DATEDIF($A2,TODAY(),"md"),DATEDIF($A2,$F2,"md"))
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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