function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dave Hill P44971Dave Hill P44971 

What is the code for a row level formula to calculate working days since created date?

I need to add a column with number of days since a task created date. Please could someone help with the code so I can just insert my created date field into it.

TIA.

Dave.
EldonEldon

Hi Dave,

Refer this thread: https://developer.salesforce.com/forums/?id=906F00000008wNHIAY
 

Regards

Dave Hill P44971Dave Hill P44971
Thanks Eldon, I'm a bit of a novice at this. Is it Start date or end date I replace with my field?

TIA
Shri RajShri Raj
IF(
  MOD(
    DATEDIFF(
      createdDate,
      DATE(1900, 1, 7)
    ),
    7
  ) >= 5,
  ROUNDUP(
    (
      DATEDIFF(
        createdDate,
        DATE(1900, 1, 7)
      )
    ) / 7,
    0
  ) * 5 + MIN(
    5,
    MOD(
      DATEDIFF(
        createdDate,
        DATE(1900, 1, 7)
      ),
      7
    )
  ),
  ROUNDDOWN(
    (
      DATEDIFF(
        createdDate,
        DATE(1900, 1, 7)
      )
    ) / 7,
    0
  ) * 5 + MIN(
    5,
    MOD(
      DATEDIFF(
        createdDate,
        DATE(1900, 1, 7)
      ),
      7
    )
  )
)


In the formula above, the createdDate field should be replaced with the actual name of your created date field. The formula assumes that work weeks start on Monday and end on Friday, and it assumes that weekends are non-working days.