Formula with date

ACQ

New Member
Joined
Mar 11, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
Dear friends,

I have to generate a table of data with dates, and return if is over 3 months from today ie. today is 07 JAN 2022, if data is in APR 2022 then return the date, if data is MAY 2022 and beyond, and return "renewed".

I had input formula =IF(C3>EOMONTH(TODAY(),3),"Renewed",B3), but all data return "renewed"

Pls help.

Thanks
AC

Book2
ABCD
1New DateUsed DateWarranty DateStatus
22022.06.060000.00.002022.06.06Renewed
32022.05.010000.00.002022.05.01Renewed
42021.04.302022.04.302022.04.30Renewed
52020.04.302022.04.302022.04.30Renewed
62020.04.302022.04.302022.04.30Renewed
72020.04.302022.04.302022.04.30Renewed
82020.04.302022.04.302022.04.30Renewed
92020.04.302022.04.302022.04.30Renewed
102020.04.302022.04.302022.04.30Renewed
112020.04.302022.04.302022.04.30Renewed
122020.04.302022.04.302022.04.30Renewed
132018.04.302022.04.302022.04.30Renewed
142018.04.302022.04.302022.04.30Renewed
152018.04.302022.04.302022.04.30Renewed
162018.04.302022.04.302022.04.30Renewed
172018.04.302022.04.302022.04.30Renewed
182017.04.302022.04.302022.04.30Renewed
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=IF(B2="0000.00.00",A2,B2)
D2:D18D2=IF(C2>EOMONTH(TODAY(),3),"Renewed",B2)
C4:C18C4=IF(B4="0000.00.00",TEXT(A4,"YYYY.MM.DD"),TEXT(B4,"YYYY.MM.DD"))
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Revise Column D formula
Excel Formula:
=IF(C2>TEXT(EOMONTH(TODAY(),3),"yyyy.mm.dd"),"Renewed",B2)
 
Upvote 0
EOMONTH(TODAY(),3) gives you the last day of the month that is 3 months from this month. That is, for today, January 6, it will return April 30, 2022. All of the dates you showed here are April 30 or later, which is why they are all "renewed."

Even if you corrected the formula to be 3 months from today
Rich (BB code):
=IF(C3>DATE(YEAR(TODAY(),MONTH(TODAY())+3,DAY(TODAY()),"Renewed",B3)
you would be checking against April 7, even earlier. And they would still all be "renewed".

So the results you showed above are perfectly consistent with what you said you wanted. What is the problem?
 
Upvote 0
EOMONTH(TODAY(),3) gives you the last day of the month that is 3 months from this month. That is, for today, January 6, it will return April 30, 2022. All of the dates you showed here are April 30 or later, which is why they are all "renewed."

Even if you corrected the formula to be 3 months from today
Rich (BB code):
=IF(C3>DATE(YEAR(TODAY(),MONTH(TODAY())+3,DAY(TODAY()),"Renewed",B3)
you would be checking against April 7, even earlier. And they would still all be "renewed".

So the results you showed above are perfectly consistent with what you said you wanted. What is the problem?
Thank you for replying.

My ideal return result is. All dated within APR 2022 will return the said date. And over APR 2022, will return "Renewed".

And this project, it's a monthly exercise. Hence it will be best if can set > 3months in formula.
 
Upvote 0
It's because it's not in the same date format. Try:
Book1.xlsx
ABCD
1New DateUsed DateWarranty DateStatus
22022.06.060000.00.002022.06.06Renewed
32022.05.010000.00.002022.05.01Renewed
42021.04.302022.04.302022.04.302022.04.30
52020.04.302022.04.302022.04.302022.04.30
62020.04.302022.04.302022.04.302022.04.30
72020.04.302022.04.302022.04.302022.04.30
82020.04.302022.04.302022.04.302022.04.30
92020.04.302022.04.302022.04.302022.04.30
102020.04.302022.04.302022.04.302022.04.30
112020.04.302022.04.302022.04.302022.04.30
122020.04.302022.04.302022.04.302022.04.30
132018.04.302022.04.302022.04.302022.04.30
142018.04.302022.04.302022.04.302022.04.30
152018.04.302022.04.302022.04.302022.04.30
162018.04.302022.04.302022.04.302022.04.30
172018.04.302022.04.302022.04.302022.04.30
182017.04.302022.04.302022.04.302022.04.30
Sheet3
Cell Formulas
RangeFormula
C2:C3C2=IF(B2="0000.00.00",A2,B2)
D2:D18D2=IF(C2>TEXT(EOMONTH(TODAY(),3),"yyyy.mm.dd"),"Renewed",B2)
C4:C18C4=IF(B4="0000.00.00",TEXT(A4,"YYYY.MM.DD"),TEXT(B4,"YYYY.MM.DD"))
 
Upvote 0
It's because it's not in the same date format. Try:
Book1.xlsx
ABCD
1New DateUsed DateWarranty DateStatus
22022.06.060000.00.002022.06.06Renewed
32022.05.010000.00.002022.05.01Renewed
42021.04.302022.04.302022.04.302022.04.30
52020.04.302022.04.302022.04.302022.04.30
62020.04.302022.04.302022.04.302022.04.30
72020.04.302022.04.302022.04.302022.04.30
82020.04.302022.04.302022.04.302022.04.30
92020.04.302022.04.302022.04.302022.04.30
102020.04.302022.04.302022.04.302022.04.30
112020.04.302022.04.302022.04.302022.04.30
122020.04.302022.04.302022.04.302022.04.30
132018.04.302022.04.302022.04.302022.04.30
142018.04.302022.04.302022.04.302022.04.30
152018.04.302022.04.302022.04.302022.04.30
162018.04.302022.04.302022.04.302022.04.30
172018.04.302022.04.302022.04.302022.04.30
182017.04.302022.04.302022.04.302022.04.30
Sheet3
Cell Formulas
RangeFormula
C2:C3C2=IF(B2="0000.00.00",A2,B2)
D2:D18D2=IF(C2>TEXT(EOMONTH(TODAY(),3),"yyyy.mm.dd"),"Renewed",B2)
C4:C18C4=IF(B4="0000.00.00",TEXT(A4,"YYYY.MM.DD"),TEXT(B4,"YYYY.MM.DD"))

Stupid me.

Thanks a lot!!!!!!!!!!!!!!!
 
Upvote 0
It's me again. As I proceed with the data, I found more logic test need to add, and I'm lost. Need help again.

1) > 3M return Renewed
2) < 2M return Expired
3) =3M return Date

However, I tried combine formula but said "Too many arguments"

How can I combine formula for d2 and d11 and return the results?

TIA

Book2
ABCD
1New DateUsed DateWarranty DateStatus
22022.06.060000.00.002022.06.06Renewed
32022.05.010000.00.002022.05.01Renewed
42018.04.302022.04.302022.04.302022.04.30
52018.04.302022.04.302022.04.302022.04.30
62018.04.302022.04.302022.04.302022.04.30
72018.04.302022.04.302022.04.302022.04.30
82018.04.302022.04.302022.04.302022.04.30
92017.04.302022.04.302022.04.302022.04.30
102022.04.010000.00.002022.04.012022.04.01
112018.02.232022.03.112022.03.11Expired
122020.01.022022.01.022022.01.02Expired
132018.05.292020.05.292020.05.29Expired
Sheet1
Cell Formulas
RangeFormula
C2:C13C2=IF(B2="0000.00.00",TEXT(A2,"YYYY.MM.DD"),TEXT(B2,"YYYY.MM.DD"))
D2:D10D2=IF(C2>TEXT(EOMONTH(TODAY(),3),"yyyy.mm.dd"),"Renewed",C2)
D11:D13D11=IF(C11<=TEXT(EOMONTH(TODAY(),2),"yyyy.mm.dd"),"Expired",C11)
 
Upvote 0
Have a look at IFS Function which is new in version 2016 or a nested IF
Standard IF you have used
Excel Formula:
=IF(logical_test,[value_if_true],[value_if_false])
Nested IF
Excel Formula:
=IF(logical_test 1,[value_if_true 1],IF(logical_test 2,[value_if_true 2],[value_if_false 3]))
 
Upvote 0
What about between 2M and 3M? Based on the info provided:
Book1.xlsx
ABCD
1New DateUsed DateWarranty DateStatus
22022.06.060000.00.002022.06.06Renewed
32022.05.010000.00.002022.05.01Renewed
42018.04.302022.04.302022.04.302022.04.30
52018.04.302022.04.302022.04.302022.04.30
62018.04.302022.04.302022.04.302022.04.30
72018.04.302022.04.302022.04.302022.04.30
82018.04.302022.04.302022.04.302022.04.30
92017.04.302022.04.302022.04.302022.04.30
102022.04.010000.00.002022.04.012022.04.01
112018.02.232022.03.112022.03.11Expired
122020.01.022022.01.022022.01.02Expired
132018.05.292020.05.292020.05.29Expired
Sheet5
Cell Formulas
RangeFormula
C2:C13C2=IF(B2="0000.00.00",TEXT(A2,"YYYY.MM.DD"),TEXT(B2,"YYYY.MM.DD"))
D2:D13D2=IFS(C2<=TEXT(EOMONTH(TODAY(),2),"yyyy.mm.dd"),"Expired",C2>TEXT(EOMONTH(TODAY(),3),"yyyy.mm.dd"),"Renewed",TRUE,C2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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