Forum Discussion

LisaSingleton's avatar
LisaSingleton
Brass Contributor
Oct 08, 2024

Help with If/And function

Trying to calculate the age of a closed item and getting errors with the below formula.  The objective is to calculate how long it took for an item to close (filtering on Closed items only).  Thanks

 


=IF(AND(I68="Closed"),M68<>"",M68-Q68,TODAY()-Q68)

  • LisaSingleton 

    =IF(AND(I68="Closed",M68<>""),M68-Q68,TODAY()-Q68)

     

    Does this work in your sheet? However it's better to share an example without sensitive data which shows the sample data along with the expected result.

  • LisaSingleton 

    =IF(AND(I68="Closed",M68<>""),M68-Q68,TODAY()-Q68)

     

    Does this work in your sheet? However it's better to share an example without sensitive data which shows the sample data along with the expected result.

    • LisaSingleton's avatar
      LisaSingleton
      Brass Contributor

      OliverScheurich 

      Thanks for your reply.  Per sample table below, I would like to calculate the age of an item as long as it's open, but once status is "closed" would like calculation to stop.  Expected result is reflected in last row, where item closed on 10/1 and eventhough today is 10/14, the days calculated is 20.   

      StatusCreated dateDate last updated 
      Pending8/9/20249/30/202466
      New9/1/2024 43
      Closed9/11/202410/1/202420
      • mathetes's avatar
        mathetes
        Silver Contributor

        LisaSingleton 

         

        Unless I'm totally mistaken, the answer you got from OliverScheurich will work. You just need to make sure the column references are the ones in your example.

         

         Here's that formula, revised using your headings. You just need to substitute the actual columns' letters for what appears [in the square brackets].

         

        =IF(AND([Status]="Closed",[Date Last Updated]=""),[Created Date]-[Date Last Updated],TODAY()-[Date Last Updated])

Resources