Calculate Days between 2 columns

Hi all

I did search for the exact problem i'm having, but no luck, truly.

I found this expression that a fellow community member made, which calculates the difference between TODAY() and then the DOB column, in DAYS:

 

CONCATENATE(
  IF(
    (
      (
        HOUR(
          TODAY()
          - (
            EOMONTH(TODAY(), -2)
            + DAY([DOB])
          )
        )
        / 24
      )
      < (
        HOUR(
          TODAY()
          - (
            EOMONTH(TODAY(), -2)
            + DAY(TODAY())
          )
        )
        / 24
      )
    ),
    (
      HOUR(
        TODAY()
        - (
          EOMONTH(TODAY(), -2)
          + DAY([DOB])
        )
      )
      / 24
    ),
    (
      HOUR(
        TODAY()
        - (
          EOMONTH(TODAY(), -1)
          + DAY([DOB])
        )
      )
      / 24
    )
  ),
  " days"
) 

However, I need it to work out the days between the DOB and another column called [Service Date (Procedure)]. This other column is a date column. It's not resulting in the correct amount of days though.

Any suggestions? Thanks.

Solved Solved
0 4 134
1 ACCEPTED SOLUTION

Generally days between two dates can be found by the expression

HOUR([Date 1] - [Date 2])/24

If you are looking for a text string result, you could try 

CONCATENATE(

HOUR([Service Date (Procedure)] - [DOB])/24, " days")

Date and time expressions - AppSheet Help

Please post back if you have some other conditions that need to be taken care of.

 

View solution in original post

4 REPLIES 4

Generally days between two dates can be found by the expression

HOUR([Date 1] - [Date 2])/24

If you are looking for a text string result, you could try 

CONCATENATE(

HOUR([Service Date (Procedure)] - [DOB])/24, " days")

Date and time expressions - AppSheet Help

Please post back if you have some other conditions that need to be taken care of.

 

Thanks so much, I'll give this a try when I'm home. Does it account for the difference in the amount of days per month etc?


@NotMat wrote:

I'll give this a try when I'm home. Does it account for the difference in the amount of days per month etc?


Yes. 

Thanks man. I recall you've helped me before in the past, legend!

Top Labels in this Space