Question about Date formula

not7here

New Member
Joined
Aug 8, 2022
Messages
4
Office Version
  1. 2021
Hi all!

Long time lurker, first time poster. Wondering if there's any advice on the following issue. I have a patient tracker (healthcare for Veterans) and I'm looking to calculate a date. A patient will have an ADMISSION DATE and for the first YEAR (365 days) I need to complete a treatment plan every three months. Once the Admission date is more than a year ago, then I need to calculate a treatment plan date that is every 6 months. So For instance:

Admission Date (column A)Last Treatment Plan Completed (column B)Next Treatment Plan due (column C)
01/01/2201/01/2207/01/22
08/01/2108/01/2202/01/23

So in this case, the user will manually put in the admission date and the last treatment plan they did. If its been less than a year since admission, the "Next" one they do will be calculated 3 months from their last completed plan. If its been more than a year, it will be calculated 6 months from their last completed plan.

Any advice? I can't wrap my head around this one.

Thank you!
Chris
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try this...
Book1
ABC
1Admission DateLast Treatment Plan CompletedNext Treatment Plan Due
21/1/20221/1/20224/1/2022
38/1/20218/1/20222/1/2023
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=IF(B2<EDATE(A2,12),EDATE(B2,3),EDATE(B2,6))
 
Upvote 0
Try this...
Book1
ABC
1Admission DateLast Treatment Plan CompletedNext Treatment Plan Due
21/1/20221/1/20224/1/2022
38/1/20218/1/20222/1/2023
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=IF(B2<EDATE(A2,12),EDATE(B2,3),EDATE(B2,6))
That's fantastic thank you! Last question I swear...

If B2 (Last treatment plan) cell is empty, can I make C2 empty as well? I've used a different IF function for that but it doesn't seem to work here. Here is the code I have which keeps getting an error:

=IF(B2<>"",=IF(B2<EDATE(A2,12),EDATE(B2,3),EDATE(B2,6)),"")
 
Upvote 0
Sure...I would do something almost like that...
MrExcel_20220808.xlsx
ABC
1Admission DateLast Treatment Plan CompletedNext Treatment Plan Due
21/1/20221/1/20224/1/2022
38/1/20218/1/20222/1/2023
41/15/2022 
51/15/20224/15/20227/15/2022
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IF(B2="","",IF(B2<EDATE(A2,12),EDATE(B2,3),EDATE(B2,6)))

I believe your formula would work fine too if you deleted the = sign in front of the 2nd IF.
 
Upvote 0
Sure...I would do something almost like that...
MrExcel_20220808.xlsx
ABC
1Admission DateLast Treatment Plan CompletedNext Treatment Plan Due
21/1/20221/1/20224/1/2022
38/1/20218/1/20222/1/2023
41/15/2022 
51/15/20224/15/20227/15/2022
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IF(B2="","",IF(B2<EDATE(A2,12),EDATE(B2,3),EDATE(B2,6)))

I believe your formula would work fine too if you deleted the = sign in front of the 2nd IF.
Thank you! Tried it though and it doesn't work when the second = is paired with the second IF. And when I remove that = sign then there's a #SPILL! error on all entries in the column.

My code is:

=IF([Last Tx Plan]="","",IF([@[Last Tx Plan]]<EDATE([@[Admit Date]],12),EDATE([@[Last Tx Plan]],3),EDATE([@[Last Tx Plan]],6)))

Where:

A2 = [Admit Date]
B2 = [Last Tx Plan]
C2 = the target cell
 
Upvote 0
Oh…you’re using structured references. Place an @ in front of the first [Last Tx Plan] to consider only the cell on that row.
Excel Formula:
=IF(@[Last Tx Plan]="","",IF([@[Last Tx Plan]]<EDATE([@[Admit Date]],12),EDATE([@[Last Tx Plan]],3),EDATE([@[Last Tx Plan]],6)))
 
Last edited:
Upvote 0
Oh…you’re using structured references. Place an @ in front of the first [Last Tx Plan] to consider only the cell on that row.
Excel Formula:
=IF(@[Last Tx Plan]="","",IF([@[Last Tx Plan]]<EDATE([@[Admit Date]],12),EDATE([@[Last Tx Plan]],3),EDATE([@[Last Tx Plan]],6)))
Works! This community is amazing. Thank you.
 
Upvote 0
I thought you might find this interesting. With structured references and a desire to deliver the results into the same table, you'll need to use the @ symbols to fix the references to the row being evaluated (see upper table). If you try to use arrays (so we're looking at entire columns in the table), and again trying to deliver the results with a single formula back into the same table, you'll get a SPILL error (see lower table). However, if you use the same formula (the array version in the lower table) and you want the results external to the table, you can enter the formula just once (here in cell E20) and the results will spill down. Excel does not have the ability to spill results within a formal table. Also note that when using some older functions (like EDATE), in order to coax them into handling arrays, the unary plus operator is used in front of the array fed into the function.
MrExcel_20220808.xlsx
ABCDE
12Admit DateLast Tx PlanNext Tx Plan Due
131/1/20221/1/20224/1/2022
148/1/20218/1/20222/1/2023
151/15/2022 
161/15/20224/15/20227/15/2022
17
18
19Admit DateLast Tx PlanNext Tx Plan DueNext Tx Plan (external to data table)
201/1/20221/1/2022#SPILL!4/1/2022
218/1/20218/1/2022#SPILL!2/1/2023
221/15/2022#SPILL!
231/15/20224/15/2022#SPILL!7/15/2022
Sheet1
Cell Formulas
RangeFormula
C13:C16C13=IF([@[Last Tx Plan]]="","",IF([@[Last Tx Plan]]<EDATE([@[Admit Date]],12),EDATE([@[Last Tx Plan]],3),EDATE([@[Last Tx Plan]],6)))
E20:E23E20=IF(Table13[Last Tx Plan]="","",IF(Table13[Last Tx Plan]<EDATE(+Table13[Admit Date],12),EDATE(+Table13[Last Tx Plan],3),EDATE(+Table13[Last Tx Plan],6)))
C20:C23C20=IF([Last Tx Plan]="","",IF([Last Tx Plan]<EDATE(+[Admit Date],12),EDATE(+[Last Tx Plan],3),EDATE(+[Last Tx Plan],6)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,234
Members
448,951
Latest member
jennlynn

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