Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:28:50+00:00 2026-06-15T02:28:50+00:00

Trying to create a formula field in salesforce to calculate the average number of

  • 0

Trying to create a formula field in salesforce to calculate the average number of days taken from Close date to (either of the 2 other dates).
E.g

Close date
Email start date
live date

formula I’m trying to write is close date – (earliest of the email start date or the live date).

Help will be appreciated.
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:28:51+00:00Added an answer on June 15, 2026 at 2:28 am

    There’s a MAX() function available but it accepts only numbers, not dates. So have a look at these and pick whichever you’re feeling more comfortable with 😉

    (Formula type must be of type Number, call it “Lifespan (in days)” or something)

    IF(Email_Start_Date__c > Live_Date__c, Email_Start_Date__c, Live_Date__c) - Close_Date__c
    

    or

    MAX(Email_Start_Date__c - Close_Date__c, Live_Date__c - Close_Date__c)
    

    Edit to incorporate Priyanka’s problem from the comments:
    If you have several dates you want to fall back on (if one is null, try another one) it’s best to use BLANKVALUE function to avoid long chains of IF statements:

    BLANKVALUE(Over_ride_Date__c, 
        BLANKVALUE(Email_Start_Date__c, 
            BLANKVALUE(Live_Date__c, 
                BLANKVALUE(Estimated_Email_Start_Date__c, Estimated_Go_Live_Date__c)
            )
        )
    )
    

    You can also combine it with the trick with IF’s to select lowest one, for example:

    BLANKVALUE(Over_ride_Date__c, 
        IF(NOT(ISBLANK(Email_Start_Date__c)) && NOT(ISBLANK(Go_Live_Date__c)), 
            IF(Email_Start_Date__c < Go_Live_Date__c, Email_Start_Date__c , Go_Live_Date__c ),
            BLANKVALUE(Estimated_Email_Start_Date__c, Estimated_Go_Live_Date__c)
        )
    )
    

    This will check the override date first. If it’s null but both email start & go live dates are set – will select smaller of the 2. If any of them is blank – will keep falling back to check estimated dates and finally will give up if with null if everything was null.

    But I have to say if you really need to write such convoluted things – you’re doing something wrong. Force your users to start filling in some dates earlier, it’s a sign of very poor data quality…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Crystal Reports formula field (to calculate the percentage change
I am trying to create a formula on column O to calculate the following:-
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
The first three columns exist. I am trying to create a formula for the
I am trying to create an application that will calculate the cost of exotic
I'm trying to create a Crystal Report that reads data from an access table.
I am trying to create a formula for a cost column which calculates the
I'm trying to create a formula that will have the effect of automatically adding
I'm trying to create a formula to check if the value in a cell
I am trying to create a formula in Microsoft Excel 2010 to accomplish the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.