Forum Discussion
O_edwardsKPPB-9
Feb 07, 2023Copper Contributor
Formula for if a date is more than X days in the past
Can someone help me with a formula for Excel? If Column A returns a set of dates, is there a function to show if the dates in Column A are more than 30, 60, 120 days in the past?
- Feb 08, 2023
another option:
=XLOOKUP(TODAY()-A1, {30,60,120}, {">30",">60",">120"}, "<30", -1)
as for Mathetes try:
=IFS(TODAY()-A1>=120,"120",TODAY()-A1>=60,"60",TODAY()-A1>=30,"30",1,"<30")one more option in case you have an old Excel version:
=VLOOKUP(TODAY()-A1,{-9999,"<30";30,">30";60,">60";120,">120"},2,1)
mathetes
Feb 07, 2023Gold Contributor
O_edwardsKPPB-9
Feb 08, 2023Copper Contributor
mathetes That is giving me an error and does not work 😕
- mtarlerFeb 08, 2023Silver Contributor
another option:
=XLOOKUP(TODAY()-A1, {30,60,120}, {">30",">60",">120"}, "<30", -1)
as for Mathetes try:
=IFS(TODAY()-A1>=120,"120",TODAY()-A1>=60,"60",TODAY()-A1>=30,"30",1,"<30")one more option in case you have an old Excel version:
=VLOOKUP(TODAY()-A1,{-9999,"<30";30,">30";60,">60";120,">120"},2,1)
- ALex1RoseMar 21, 2025Copper Contributor
This comes back with an error on my Microsoft 365, with Windows 11.
Even ChatGPT can't give a formula for something as simple as a todays date being close to an expiry date.
Either ChatGPT sucks, or 365 sucks.- SergeiBaklanMar 22, 2025Diamond Contributor
Formula from mtarler works practically on any Excel, includes 365. What exactly is wrong, from your screenshot it's not clear what you try to do. Task to have "todays date being close to an expiry date" also not clear, at least for me.