Forum Discussion

O_edwardsKPPB-9's avatar
O_edwardsKPPB-9
Copper Contributor
Feb 07, 2023
Solved

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?

  • mtarler's avatar
    mtarler
    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)

      • mtarler's avatar
        mtarler
        Silver 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)

Resources