Skip to main content
I have a report which is based on a date range (From and To).  I would like to calculate a number of days between the 2 range dates in a separate column.  I cannot figure out how to access the "From" and "To" dates in a formula.

 

Thank you
6 respostas
  1. 27 de jan. de 2014, 17:51
    +1 EvanD 

     

    Here's a Formula you can use and a great resource in the onlinr Help => Common Date Formulas (https://help.salesforce.com/HTViewHelpDoc?id=formula_examples_dates.htm&language=en_US)

     

     

     

     Finding the Number of Business Days Between Two Dates

     

    Calculating how many business days passed between two dates is slightly more complex than calculating total elapsed days. The basic strategy is to choose a reference Monday from the past and find out how many full weeks and any additional portion of a week have passed between the reference date and the date you’re examining. These values are multiplied by five (for a five-day work week) and then the difference between them is taken to calculate business days.

     

    (5 * ( FLOOR( ( date_1 - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( date_1 - DATE( 1900, 1, 8), 7 ) ) )

     

    -

     

    (5 * ( FLOOR( ( date_2 - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( date_2 - DATE( 1900, 1, 8), 7 ) ) )

     

    In this formula, date_1 is the more recent date and date_2 is the earlier date. If your work week runs shorter or longer than five days, replace all fives in the formula with the length of your week.
0/9000