• No results found

USEFUL FORMULA FIELDS

N/A
N/A
Protected

Academic year: 2021

Share "USEFUL FORMULA FIELDS"

Copied!
91
0
0

Loading.... (view fulltext now)

Full text

(1)

Available in: All Editions

User Permissions Needed

“View Setup and Configuration” To view formula field details:

“Customize Application” To create, change, or delete formula fields:

Use the following formula samples when creating custom formula fields. For samples of other types of formulas, see “Examples of Validation Rules” in the Salesforce.com online help and “Useful Default Field Value Formulas” in the Salesforce.com online help.

This document contains the following categories of custom formula samples: • Account Management

• Account Media Service Links • Case Management • Commission Calculations • Contact Management • Data Categorization • Date Calculations • Discounting • Employee Services • Expense Tracking • Financial Calculations • Image Links • Integration Links • Lead Management • Metrics • Opportunity Management • Pricing • Project Management • Scoring Calculations

(2)

Account Management

Account Rating

This formula evaluates Annual Revenue,Billing Country, and Type, and assigns a value of “Hot,” “Warm,” or “Cold.”

IF (AND (AnnualRevenue > 10000000,

CONTAINS (CASE (BillingCountry, "United States", "US", "America", "US", "USA", "US", "NA"), "US")),

IF(ISPICKVAL(Type, "Manufacturing Partner"), "Hot", IF(OR (ISPICKVAL (Type, "Channel Partner/Reseller"),

ISPICKVAL(Type, "Installation Partner")), "Warm", "Cold")), "Cold")

For details about using these functions, see IF on page 53,AND on page 40,CONTAINS on page 45,CASE on page 42, and ISPICKVAL on page 64.

In addition, you can reference this Account Rating formula field from the contact object using cross-object formulas.

Account.Account_Rating__c

Account Region

This formula returns a text value of “North,” “South,” “East,” “West,” or “Central” based on the Billing State/Province of the account.

IF(ISBLANK(BillingState), "None",

IF(CONTAINS("AK:AZ:CA:HA:NV:NM:OR:UT:WA", BillingState), "West", IF(CONTAINS("CO:ID:MT:KS:OK:TX:WY", BillingState), "Central", IF(CONTAINS("CT:ME:MA:NH:NY:PA:RI:VT", BillingState), "East", IF(CONTAINS("AL:AR:DC:DE:FL:GA:KY:LA:MD:MS:NC:NJ:SC:TN:VA:WV", BillingState), "South",

IF(CONTAINS("IL:IN:IA:MI:MN:MO:NE:ND:OH:SD:WI", BillingState), "North", "Other"))))))

For details about using these functions, see IF on page 53,LEN on page 66, and CONTAINS on page 45.

Contract Aging

This formula calculates the number of days since a contract with an account was activated. If the contract Status is not “Activated,” this field is blank.

IF(ISPICKVAL(Contract_Status__c, "Activated"), NOW() - Contract_Activated_Date__c, null)

For details about using these functions, see IF on page 53,ISPICKVAL on page 64, and NOW on page 74.

Contract Approval Process Aging

This formula calculates how many days a contract is in the approval process. This example is a number formula field on contracts that uses a custom date field called Date in approval.

(3)

TODAY()-Date_in_approval__c

For details about using this function, see TODAY on page 84.

Month of Last Account Activity

This formula field displays the month of the last account activity or “None” if there are no activities for the account.

CASE(MONTH(LastActivityDate), 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December", "None")

For details about using these functions, see CASE on page 42 and MONTH on page 73.

Month of Service-Level Agreement Expiration

This formula returns the month that your service-level agreement expires. This example uses a custom date field called SLA Expiration Date.

MONTH(SLAExpirationDate__c)

For details about using this function, see MONTH on page 73.

Account Media Service Links

BBC™ News Search

This formula creates a link to a BBC news search site based on the Account Name.

HYPERLINK(

"http://newssearch.bbc.co.uk/cgi-bin/search/results.pl?scope=newsifs;tab=news;q="&Name, "BBC News")

Bloomberg™ News Search

This formula creates a link to an account's ticker symbol on the Bloomberg website.

HYPERLINK(

"http://www.bloomberg.com/apps/quote?ticker="&TickerSymbol, "Bloomberg News")

(4)

CNN™ News Search

This formula creates a link to a CNN news search site using the Account Name.

HYPERLINK(

"http://websearch.cnn.com/search/search?source=cnn&invocationType=search%2Ftop&sites=web&query="&Name, "CNN News")

MarketWatch™ Search

This formula creates a link to an account's ticker symbol on the Marketwatch.com website.

HYPERLINK(

"http://www.marketwatch.com/tools/quotes/quotes.asp?symb="&TickerSymbol, "Marketwatch")

Google™ Search

This formula creates a link to a Google search site using the Account Name.

HYPERLINK(

"http://www.google.com/search?en&q="&Name, "Google")

Google News Search

This formula creates a link to a Google news search site using the Account Name.

HYPERLINK(

"http://www.google.com/news?en&q="&Name, "Google News")

Yahoo!™ Search

This formula creates a link to a Yahoo! search site using the Account Name.

HYPERLINK(

"http://search.yahoo.com/search?p="&Name, "Yahoo Search")

Yahoo News Search

This formula creates a link to a Yahoo! news search site using the Account Name.

HYPERLINK(

"http://news.search.yahoo.com/search/news?p="&Name, "Yahoo News")

(5)

Case Management

Autodial

This formula creates a linkable phone number field that automatically dials the phone number when clicked. In this example, replace "servername" and "call" with the name of your dialing tool and the command it uses to dial. The merge field,Id, inserts the identifier for the contact, lead, or account record. The first Phone merge field tells the dialing tool what number to call and the last Phone merge field uses the value of the Phone field as the linkable text the user clicks to dial.

HYPERLINK("http://servername/call?id=" & Id & "&phone=" & Phone, Phone) For details about using this function, see HYPERLINK on page 51.

Case Aging (Assignments)

Use this example of a custom formula field called Days Open to display different text depending on the number of days a case has been open:

CASE(Days_Open__c, 3,

"Reassign", 2, "Assign Task", "Maintain") The following text is displayed:

• “Reassign” for any case open three days. • “Assign Task” for any case open two days. • “Maintain” for all other cases.

For details about using this function, see CASE on page 42.

Case Aging (Open Cases)

This formula calculates the number of days a case has been open. If the case is closed, it sets the result to null. Add this formula to a related list as the sort column to quickly see which open cases have been open the longest. The formula returns zero if the case has been open for less than 24 hours.

IF(IsClosed, null,

NOW() - CreatedDate )

For details about using these functions, see IF on page 53 and NOW on page 74.

Case Aging (Open and Closed Cases)

This formula calculates the number of days a closed case was open or the number of days an open case has been open since the date the case was created. The formula returns zero if the case has been open for less than 24 hours.

IF(IsClosed,

(6)

For details about using these functions, see IF on page 53,ROUND on page 80, and NOW on page 74.

Case Categorization

This formula displays a text value of “RED,” “YELLOW,” or “GREEN,” depending on the value of a case age custom text field.

IF(DaysOpen__c > 20, "RED", IF(DaysOpen__c > 10, "YELLOW", "GREEN") )

For details about using this function, see IF on page 53.

Case Data Completeness Tracking

This formula calculates the percentage of specific custom fields that contain data. The formula checks the values of two custom number fields:Problem Num and Severity Num. If the fields are empty, the formula returns the value “0.” The formula returns a value of “1” for each field that contains a value and multiplies this total by fifty to give you the percentage of fields that contain data.

(IF(ISBLANK(Problem_Num__c), 0, 1) + IF(ISBLANK(Severity_Num__c ), 0,1)) * 50

For details about using these functions, see IF on page 53 and ISBLANK on page 58.

Case Due Date Calculation

This formula sets the due date of a case based on the priority. If it is high, the due date is two days after it opens. If it is medium, the due date is five days after opening. Otherwise, the due date is seven days.

CASE (Priority,

"High", CreatedDate + 2, "Medium",CreatedDate + 5, CreatedDate + 7)

For details about using this function, see CASE on page 42.

Suggested Agent Prompts

This formula prompts an agent with cross-sell offers based on past purchases.

CASE(Product_Purch__c,

"Printer", "Extra toner cartridges", "Camera", "Memory cards", "Special of the day")

(7)

Suggested Offers

This formula suggests a product based on the support history for a computer reseller. When the Problem custom field matches a field, the formula field returns a suggestion.

CASE(Problem__c,

"Memory", "Suggest new memory cards", "Hard Drive failure", "Suggest new hard drive with tape backup",

"")

For details about using this function, see CASE on page 42.

Commission Calculations

Commission Amounts for Opportunities

The following is a simple formula where commission is based on a flat 2% of the opportunity Amount.

IF(ISPICKVAL(StageName, "Closed Won"), ROUND(Amount *0.02, 2), 0)

This example calculates the commission amount for any opportunity that has a “Closed Won” stage. The value of this field will be the amount times 0.02 for any closed/won opportunity. Open or lost opportunities will have a zero commission value.

For details about using these functions, see IF on page 53,ISPICKVAL on page 64, and ROUND on page 80.

Commission Deal Size

This formula calculates a commission rate based on deal size, returning a 9% commission rate for deals over 100,000 and an 8% commission rate for smaller deals.

IF(Amount > 100000, 0.09, 0.08 )

For details about using this function, see IF on page 53.

Commission Greater Than or Equal To

This formula assigns the “YES” value to opportunities with a commission greater than or equal to one million. Note, this is a text formula field on opportunities that uses a custom currency field called Commission.

IF(Commission__c >= 1000000, "YES", "NO") For details about using this function, see IF on page 53.

(8)

Commission Maximum

This formula determines what commission to log for an asset based on which is greater: the user's commission percentage of the price, the price times the discount percent stored for the account or 100 dollars. This example assumes you have two custom percent fields on users and assets.

MAX($User.Commission_Percent__c * Price, Price * Account_Discount__c, 100)

For details about using this function, see MAX on page 70.

Contact Management

Contact's Account Creation Date

This date formula displays the account's Created Date field on the contacts page. Account.CreatedDate

Contact's Account Discount Percent

This percent formula displays the account's Discount Percent field on the contacts page. Account.Discount_Percent__c

Contact's Account Name

This formula displays the standard Account Name field on the contacts page. Account.Name

Contact's Account Phone

This formula displays the standard Account Phone field on the contacts page. Account.Phone

Contact's Account Rating

Use this formula to display the Account Rating field on the contacts page.

CASE(Account.Rating, "Hot", "Hot", "Warm", "Warm", "Cold", "Cold", "Not Rated")

For details about using this function, see CASE on page 42.

Contact's Account Website

This formula displays the standard Account Website field on the contacts page. Account.Website

(9)

If the account website URL is long, use the HYPERLINK function to display a label such as “Click Here” instead of the URL. For example:

IF(Account.Website="", "", IF(

OR(LEFT(Account.Website, 7) = "http://",LEFT(Account.Website, 8) = "https://"),

HYPERLINK( Account.Website , "Click Here" ),

HYPERLINK( "http://" & Account.Website , "Click Here" ) )

)

This formula also adds the necessary "http://" or "https://" before a URL if neither were included in the URL field.

For details about using this function, see HYPERLINK on page 51.

Contact’s Age

Use this formula to calculate a person’s age based on a standard field called Birthdate. The person’s Birthdate is subtracted from today’s date, which returns the number of days since the person’s Birthdate. This number is divided by the number of days in a year and rounded down to the nearest integer.

FLOOR((TODAY()-Birthdate)/365.2425)

For details about using these functions, see FLOOR on page 49 and TODAY on page 84.

Contact's Birthday

This formula displays the value “Yes” if the contact’s birthday falls in the current calendar month.

IF (

MONTH( Birthdate) = MONTH( TODAY()), "Yes", "")

For details about using these functions, see IF on page 53,MONTH on page 73, and TODAY on page 84.

Contact Identification Numbering

This formula displays the first five characters of the contact’s last name and the last four characters of the contact’s social security number separated by a dash. Note that this example uses a text custom field called SSN on contacts.

TRIM(LEFT(LastName, 5)) & "-" & TRIM(RIGHT(SSN__c, 4))

For details about using these functions, see TRIM on page 85,LEFT on page 65, and RIGHT on page 79.

Contact Preferred Phone

This formula displays the contact’s preferred contact method in a contact related list—work phone, home phone, or mobile phone—based on a selected option in a Preferred Phone custom picklist.

CASE(Preferred_Phone__c, "Work", "w. " & Phone, "Home", "h. " & HomePhone, "Mobile", "m. " & MobilePhone, "No Preferred Phone")

(10)

For details about using this function, see CASE on page 42.

Contact Priority

This formula assesses the importance of a contact based on the account rating and the contact's title. If the account rating is Hot or the title starts with Executive, then the priority is high (P1). If the account rating is Warm or the title starts with VP then the priority is medium (P2), and if the account rating is Cold then the priority is low (P3).

IF(OR(ISPICKVAL(Account.Rating, "Hot"), CONTAINS(Title, "Executive")), "P1",

IF(OR(ISPICKVAL(Account.Rating, "Warm"), CONTAINS(Title, "VP")), "P2",

IF(ISPICKVAL(Account.Rating, "Cold"), "P3", "P3")

) )

Contact Yahoo! ID

This formula displays a clickable Yahoo! Messenger icon indicating if the person is logged on to the service. Users can click the icon to launch a Yahoo! Messenger conversation with the person. This example uses a custom text field called Yahoo Name on contacts where you can store the contact's Yahoo! Messenger ID.

HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,

IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c & "&m;=g&t;=0", "Yahoo"))

For details about using these functions, see HYPERLINK on page 51 and IMAGE on page 55.

Dynamic Address Formatting

This formula field displays a formatted mailing address for a contact in standard format, including spaces and line breaks where appropriate depending on the country for the account.

CASE(ShippingCountry, "USA",

ShippingStreet & BR() & ShippingCity & ",

" & ShippingState & " " & ShippingPostalCode & BR() & ShippingCountry,

"France",

ShippingStreet & BR() & ShippingPostalCode & " " & ShippingCity & BR() & ShippingCountry, "etc")

(11)

Telephone Country Code

This formula determines the telephone country code of a contact based on the Mailing Country of the mailing address.

CASE(MailingCountry, "USA", "1", "Canada", "1", "France", "33", "UK", "44", "Australia", "61", "Japan", "81", "?")

For details about using this function, see CASE on page 42.

Unformatted Phone Number

This formula removes the parentheses and dash characters from North American phone numbers. This is necessary for some auto-dialer software.

IF(Country_Code__c = "1", MID( Phone ,2, 3) & MID(Phone,7,3) & MID(Phone,11,4), Phone)

For details about using these functions, see IF on page 53 and MID on page 71.

Data Categorization

Deal Size Large and Small

This formula displays “Large Deal” for deals over one million dollars or “Small Deal” for deals under one million dollars.

IF(Sales_Price__c > 1000000, "Large Deal",

"Small Deal")

For details about using this function, see IF on page 53.

Deal Size Small

This formula displays “Small” if the price and quantity are less than one. This field is blank if the asset has a price or quantity greater than one.

IF(AND(Price<1,Quantity<1),"Small", null)

For details about using these functions, see IF on page 53 and AND on page 40.

Product Categorization

This formula checks the content of a custom text field named Product_Type and returns “Parts” for any product with the word “part” in it. Otherwise, it returns “Service.” Note that the values are

(12)

case sensitive, so if a Product_Type field contains the text “Part” or “PART,” this formula returns “Services.”

IF(CONTAINS(Product_Type__c, "part"), "Parts", "Service")

For details about using these functions, see IF on page 53 and CONTAINS on page 45.

Date Calculations

Birthday in Current Year Accounting for Leap Years

This formula returns the date of a person's birthday in the current year, even if the person's birthday is on February 29th in a leap year.

IF(AND(MONTH(Birthdate) = 2, DAY(Birthdate) = 29), (IF(OR(MOD(YEAR(DATEVALUE(NOW())), 400) = 0,

AND(MOD(YEAR(DATEVALUE(NOW())) ,4) = 0, MOD(YEAR(DATEVALUE(NOW())), 100) <> 0)),

DATE(YEAR(DATEVALUE(NOW())), MONTH(Birthdate), DAY(Birthdate)), DATE(YEAR(DATEVALUE(NOW())), MONTH(Birthdate + 1), 28))),

(DATE(YEAR(DATEVALUE(NOW())), MONTH(Birthdate) , DAY(Birthdate)))) Day of Week (number)

This formula calculates today’s day of the week as a number (0 = Sunday, 1 = Monday, 2 = Tuesday, and so on).

MOD(TODAY() - DATE(1900, 1, 7), 7)

Similarly, this formula substitutes the TODAY() function shown in the previous example with a custom date field called Sign Up Date. It returns the day of the week as a number for that field.

MOD(Sign_Up_Date__c - DATE(1900, 1, 7), 7)

For details about using these functions, see MOD on page 72,TODAY on page 84, and DATE on page 46.

Day of Week (text)

This formula calculates today’s day of the week and displays it as text. To determine the day of the week for a date field, use the formula below and replace “TODAY()” with that date field.

CASE( MOD(TODAY() - DATE(1900, 1, 7), 7), 0, "Sunday", 1, "Monday", 2, "Tuesday", 3, "Wednesday", 4, "Thursday", 5, "Friday", 6, "Saturday", "Error")

(13)

For details about using these functions, see CASE on page 42,MOD on page 72,TODAY on page 84, and DATE on page 46.

Day of Year

This formula calculates today’s numeric day of the year (a number between 1 and 365).

TODAY() – DATE(YEAR(TODAY()), 1, 1) + 1

For details about using these functions, see TODAY on page 84,DATE on page 46, and YEAR on page 91.

Days Until End of Month

This formula displays the number of days between a specific date and the end of the month in which the date occurs.

IF(

MONTH(CloseDate)=12,

DATE(YEAR(CloseDate),12,31) - CloseDate, DATE(YEAR(CloseDate),

MONTH(CloseDate)+1,1) - CloseDate-1)

For details about using these functions, see IF on page 53,MONTH on page 73,DATE on page 46, and YEAR on page 91.

Time of Day

This formula returns the time of day in Greenwich Mean Time (GMT), for example: “20:04 PM”).

MID (TEXT (Due_Date_Time__c), 12, 5)

For details about using these functions, see MID on page 71 and TEXT on page 82.

Discounting

Maintenance and Services Discount

This formula field uses two custom currency fields:Maintenance Amount and Services Amount. It displays “Discounted” on an opportunity if its maintenance amount and services amount do not equal the opportunity Amount standard field value. Otherwise, it displays "Full Price."

IF(Maintenance_Amount__c + Services_Amount__c <> Amount, "Discounted",

"Full Price")

(14)

Opportunity Discount Amount

This formula calculates the difference of the opportunity Amount less the Discount Amount. Note that Discount Amount is a custom currency field on opportunities.

Amount - Discount_Amount__c

For details about using this operator, see - (Subtract) on page 33.

Opportunity Discount Rounded

Use this formula to calculate the discounted amount of an opportunity rounded off to two digits. This example is a number formula field on opportunities that uses a custom percent field called Discount Percent.

ROUND(Amount-Amount* Discount_Percent__c,2) For details about using this function, see ROUND on page 80.

Opportunity Discount with Approval

This formula adds a “Discount Approved” checkbox to an opportunity. It uses conditional logic to check the value of the approval flag before calculating the commission.

IF(Discount_Approved__c, ROUND(Amount – Amount * DiscountPercent__c, 2), Amount)

For details about using these functions, see IF on page 53 and ROUND on page 80.

Employee Services

Bonus Calculation

This example determines an employee's bonus amount based on the smallest of two amounts: the employee's gross times bonus percent or an equally divided amount of the company's performance amount among all employees. It assumes you have custom number field for Number of

Employees, a custom percent field for Bonus Percent, and currency custom fields for the employee's Gross and company's Performance.

MIN(Gross__c * Bonus_Percent__c,

Performance__c / Number_of_Employees__c) For details about using this function, see MIN on page 72.

Employee 401K

This example formula determines which amount to provide in employee 401K matching based on a matching program of half of the employee's contribution or $250, whichever is less. It assumes you have custom currency field for Contribution.

MIN(250, Contribution__c /2)

(15)

Hours Worked Per Week

This formula uses a custom tab to enable time tracking of hours worked per day. It uses a formula field to sum the hours per week.

MonHours__c + TuesHours__c + WedsHours__c + ThursHours__c + FriHours__c For details about using this operator, see + (Add) on page 33.

Total Pay Amount

This formula determines total pay by calculating regular hours multiplied by a regular pay rate, plus overtime hours multiplied by an overtime pay rate.

Total Pay =

IF(Total_Hours__c <= 40, Total_Hours__c * Hourly_Rate__c, 40 * Hourly_Rate__c +

(Total_Hours__c - 40) * Overtime_Rate__c) For details about using this function, see IF on page 53.

Expense Tracking

Expense Identifier

This formula displays the text “Expense-” followed by trip name and the expense number. This is a text formula field that uses an expense number custom field.

"Expense-" & Trip_Name__c & "-" & ExpenseNum__c For details about using this operator, see - (Subtract) on page 33.

Mileage Calculation

This formula calculates mileage expenses for visiting a customer site at 35 cents a mile.

Miles_Driven__c * 0.35

For details about using this operator, see * (Multiply) on page 34.

Financial Calculations

Compound Interest

This formula calculates the interest, you will have after T years, compounded M times per year.

(16)

For details about using these operators, see * (Multiply) on page 34,/ (Divide) on page 34, and ^ (Exponentiation) on page 35.

Compound Interest Continuous

This formula calculates the interest that will have accumulated after T years, if continuously compounded.

Principal__c * EXP(Rate__c * T)

For details about using this function, see EXP on page 47.

Consultant Cost

This formula calculates the number of consulting days times 1200 given that this formula field is a currency data type and consulting charges a rate of $1200 per day. Note that Consulting Days is a custom field on opportunities.

Consulting_Days__c * 1200

For details about using this operator, see * (Multiply) on page 34.

Gross Margin

This formula provides a simple calculation of gross margin. In this formula example,Total Sales and Cost of Goods Sold are custom currency fields.

Total_Sales__c - Cost_of_Goods_Sold__c

For details about using this operator, see - (Subtract) on page 33.

Gross Margin Percent

This formula calculates the gross margin based on a margin percent.

Margin_percent__c * Items_Sold__c * Price_item__c For details about using this operator, see * (Multiply) on page 34.

Payment Due Indicator

This formula returns the date five days after the contract start date whenever Payment Due Date is blank.Payment Due Date is a custom date field on contracts.

(BLANKVALUE(Payment_Due_Date__c, StartDate +5) For details about using this function, see BLANKVALUE on page 41.

Payment Status

This formula determines if the payment due date is past and the payment status is “UNPAID.” If so, it returns the text “PAYMENT OVERDUE” and if not, it leaves the field blank. This example

(17)

uses a custom date field called Payment Due Date and a text custom field called Payment Status on contracts. IF( AND(Payment_Due_Date__c < TODAY(), ISPICKVAL(Payment_Status__c, "UNPAID")), "PAYMENT OVERDUE", null )

For details about using these functions, see IF on page 53,AND on page 40,TODAY on page 84, and ISPICKVAL on page 64.

Image Links

Yahoo! Instant Messenger™ Image

This formula displays an image that indicates whether a contact or user is currently logged in to Yahoo! Instant Messenger. Clicking the image launches the Yahoo! Instant Messenger window. This formula uses a custom text field called Yahoo Name to store the contact or user’s Yahoo! ID.

IF(ISBLANK(Yahoo_Name__c),"", HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c, IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c & "&m=g&t=0", "

")))

For details about using these functions, see IF on page 53,LEN on page 66,HYPERLINK on page 51, and IMAGE on page 55.

“Skype Me™” Auto Dialer Button

This formula displays an image that looks like a push button. Clicking the button automatically dials the specified phone number.

HYPERLINK("callto://" & "+1" & Phone,

IMAGE("http://goodies.skype.com/graphics/skypeme_btn_small_blue.gif", "Click to Skype"))

For details about using these functions, see HYPERLINK on page 51 and IMAGE on page 55.

Flags for Case Priority

This formula displays a green, yellow, or red flag image to indicate case priority.

IMAGE( CASE( Priority, "Low", "/img/samples/flag_green.gif", "Medium", "/img/samples/flag_yellow.gif", "High", "/img/samples/flag_red.gif", "/s.gif"), "Priority Flag")

(18)

Color Squares for Case Age

This formula displays a 30 x 30 pixel image of a red, yellow, or green, depending on the value of a Case Age custom text field.

IF( Case_Age__c > 20, IMAGE("/img/samples/color_red.gif", "red", 30, 30), IF( Case_Age__c > 10, IMAGE("/img/samples/color_yellow.gif", "yellow", 30, 30), IMAGE("/img/samples/color_green.gif", "green", 30, 30), ))

For details about using these functions, see IF on page 53 and IMAGE on page 55.

Traffic Lights for Status

This formula displays a green, yellow, or red traffic light images to indicate status, using a custom picklist field called Project Status. Use this formula in list views and reports to create a “Status Summary” dashboard view.

IMAGE( CASE(Project_Status__c, "Green", "/img/samples/light_green.gif", "Yellow", "/img/samples/light_yellow.gif", "Red", "/img/samples/light_red.gif", "/s.gif"), "status color")

For details about using these functions, see IMAGE on page 55 and CASE on page 42.

Stars for Ratings

This formula displays a set of one to five stars to indicate a rating or score.

IMAGE( CASE(Rating__c, "1", "/img/samples/stars_100.gif", "2", "/img/samples/stars_200.gif", "3", "/img/samples/stars_300.gif", "4", "/img/samples/stars_400.gif", "5", "/img/samples/stars_500.gif", "/img/samples/stars_000.gif"), "rating")

For details about using these functions, see IMAGE on page 55 and CASE on page 42.

Consumer Reports™-Style Colored Circles for Ratings

This formula displays a colored circle to indicate a rating on a scale of one to five, where solid red is one, half red is two, black outline is three, half black is four, and solid black is five.

IMAGE( CASE(Rating__c, "1", "/img/samples/rating1.gif", "2", "/img/samples/rating2.gif", "3", "/img/samples/rating3.gif", "4", "/img/samples/rating4.gif", "5", "/img/samples/rating5.gif", "/s.gif"), "rating")

(19)

For details about using these functions, see IMAGE on page 55 and CASE on page 42.

Horizontal Bars to Indicate Scoring

This formula displays a horizontal color bar (green on a white background) of a length that is proportional to a numeric score. In this example, the maximum length of the bar is 200 pixels.

IMAGE("/img/samples/color_green.gif", "green", 15, Industry_Score__c * 2) &

IMAGE("/s.gif", "white", 15, 200 - (Industry_Score__c * 2))

For details about using this function, see IMAGE on page 55.

Integration Links

Application API Link

This formula creates a link to an application outside Salesforce.com, passing the parameters so that it can connect to Salesforce.com via the Force.com Web Services API and create the necessary event.

HYPERLINK ("https://www.myintegration.com?sId=" & GETSESSIONID() & "?&rowID=" & Name & "action=CreateTask","Create a Meeting Request") For details about using these functions, see HYPERLINK on page 51 and GETSESSIONID on page 51.

Shipment Tracking Integration

This formula creates a link to FedEx, UPS, or DHL shipment tracking websites, depending on the value of a Shipping Method custom picklist field. Note that the parameters shown in this example for FedEx, UPS, and DHL websites are illustrative and do not represent the correct parameters for all situations.

CASE(Shipping_Method__c, "Fedex", HYPERLINK("http://www.fedex.com/Tracking?ascend_header=1&clienttype =dotcom&cntry_code=us&language=english&tracknumbers= "& tracking_id__c,"Track"), "UPS", HYPERLINK("http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion =5.0&sort_by=status&loc=en_US&InquiryNumber1= "& tracking_id__c & "&track.x=32&track.y=7", "Track") ,

"DHL",

HYPERLINK("http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=" & tracking_id__c,"Track"), "")

(20)

Skype Auto Dialer Integration

This formula creates a linkable phone number field that automatically dials the phone number via the Skype VOIP phone application. It requires installation of the Skype application (a third-party product not provided by salesforce.com) on your desktop.

HYPERLINK("callto://+" & Country_Code__c & Phone_Unformatted__c, Phone) For details about using this function, see HYPERLINK on page 51.

Lead Management

Lead Aging (for open leads)

This formula checks to see if a lead is open and if so, calculates the number of days it has been open by subtracting the date and time created from the current date and time. The result is the number of days open rounded to zero decimal places. If the lead is not open, this field is blank.

IF(ISPICKVAL(Status, "Open"), ROUND(NOW()-CreatedDate, 0), null) For details about using these functions, see IF on page 53,ISPICKVAL on page 64,ROUND on page 80, and NOW on page 74.

Lead Data Completeness

This formula calculates the percent of certain lead fields that your sales personnel enter. The formula field checks the values of two custom number fields:Phone and Email. If the fields are empty, the formula returns the value “0.” The formula returns a value of “1” for each field that contains a value and multiplies this total by fifty to give you the percentage of fields that contain data.

(IF(Phone = "", 0, 1) + IF(Email = "", 0, 1) ) * 50 For details about using this function, see IF on page 53.

Lead Numbering

This formula returns a number value for the text value in the auto-number field Lead Number. This can be useful if you want to use the Lead Number field in a calculation, such as round-robin or other routing purposes. Note that auto-number fields are text fields and must be converted to a number for numeric calculations.

VALUE(Lead_Number__c)

For details about using this function, see VALUE on page 89.

Round Robin Assignment of Cases or Leads

The following formula example for leads assumes you have three lead queues and you want to assign an equal number of incoming leads to each queue. You can also assign cases using a similar formula. MOD(VALUE(Lead_Number__c), 3)

(21)

This formula is for a custom formula field named Round_Robin_ID that assigns each lead a value of 0, 1, or 2. This formula uses a custom auto-number field called Lead Number that assigns each lead a sequential number starting with 1. The MOD function divides the lead number by the number of lead queues available (three in this example) and returns a remainder of 0, 1, or 2. Use the value of this formula field in your lead assignment rules to assign lead records to different queues. For example:

• Round_Robin_ID = 0 is assigned to Queue A • Round_Robin_ID = 1 is assigned to Queue B • Round_Robin_ID = 2 is assigned to Queue C

For details about using these functions, see MOD on page 72 and VALUE on page 89.

Metrics

Temperature Conversion

This formula converts Celsius degrees to Fahrenheit.

1.8 * degrees_celsius__c + 32

For details about using these operators, see * (Multiply) on page 34 and + (Add) on page 33.

Unit of Measure Conversion

This formula converts kilometers to miles.

Miles__c/.621371192

For details about using this operator, see / (Divide) on page 34.

Opportunity Management

Days Left to Close

This formula returns the expected number of days left to the close date of an opportunity.

Expected_close_date__c -TODAY()

(22)

Display Close Month for Reporting Purposes

This formula returns the month in text for the close date of an opportunity. Use this example when building a custom report that groups opportunities by the month of the Close Date.

CASE( MONTH(CloseDate), 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December", "Invalid month")

For details about using these functions, see CASE on page 42 and MONTH on page 73.

Expected Product Revenue

This formula calculates total revenue from multiple products, each with a different probability of closing.

ProductA_probability__c * ProductA_revenue__c + ProductB_probability__c * ProductB_revenue__c

For details about using these operators, see * (Multiply) on page 34 and + (Add) on page 33.

Maintenance Calculation

This formula calculates maintenance fees as 20% of license fees per year.Maintenance Years is a custom field on opportunities.

Amount * Maint_Years__c * 0.2

For details about using this operator, see * (Multiply) on page 34.

Monthly Subscription-Based Calculated Amounts

This formula calculates an opportunity amount based on a monthly subscription rate multiplied by the subscription period.

Monthly_Amount__c * Subscription_Months__c For details about using this operator, see * (Multiply) on page 34.

Monthly Value

This formula divides total yearly value by 12 months.

(23)

For details about using this operator, see / (Divide) on page 34.

Opportunity Additional Costs

This formula calculates the sum of the opportunity Amount, maintenance amount, and services fees. Note that Maint amount and Service Fees are custom currency fields on opportunities. Amount + Maint_Amount__c + Services_Amount__c

For details about using this operator, see + (Add) on page 33.

Opportunity Categorization

This formula uses conditional logic to populate an Opportunity category text field, based on the value of the Amount standard field. Opportunities with amounts less than $1500 are “Category 1,” those between $1500 and $10000 are “Category 2,” and the rest are “Category 3.” This example uses nested IF statements.

IF(Amount < 1500, "Category 1", IF(Amount > 10000, "Category 3", "Category 2"))

For details about using this function, see IF on page 53.

Opportunity Data Completeness

This formula takes a group of opportunity fields and calculates what percent of them are being used by your sales personnel. This formula field checks five fields to see if they are blank. If so, a zero is counted for that field. A “1” is counted for any field that contains a value and this total is divided by five (the number of fields evaluated). Note that this formula requires you select the Treat blank fields as blanks option under Blank Field Handling while the Advanced Formula subtab is showing. (IF(ISBLANK(Maint_Amount__c), 0, 1) + IF(ISBLANK(Services_Amount__c), 0,1) + IF(ISBLANK(Discount_Percent__c), 0, 1) + IF(ISBLANK(Amount), 0, 1) + IF(ISBLANK(Timeline__c), 0, 1)) / 5

For details about using this function, see ISBLANK on page 58.

Opportunity Expected License Revenue

This formula calculates expected revenue for licenses based on probability of closing.

Expected_rev_licenses__c * Probability

For details about using this operator, see * (Multiply) on page 34.

Opportunity Reminder Date

This formula creates reminder date based on seven days before the close date of an opportunity. Use this formula field in a workflow rule to create an event for the appropriate user to take action.

(24)

For details about using these operators, see = and == (Equal) on page 36 and - (Subtract) on page 33.

Opportunity Revenue Text Display

This formula returns the expected revenue amount of an opportunity in text format without a dollar sign. For example, if the Expected Revenue of a campaign is “$200,000,” this formula field displays “200000.”

TEXT(ExpectedRevenue)

For details about using this function, see TEXT on page 82.

Opportunity Split Credit for Sales Representatives

This formula splits opportunity amount between multiple sales representatives. The total reps custom field indicates the total number of representatives on the deal.

Amount / total_reps__c

For details about using this operator, see / (Divide) on page 34.

Opportunity Total Deal Size

This formula calculates the sum of maintenance and services amounts.

Amount + Maint_Amount__c + Services_Amount__c For details about using this operator, see + (Add) on page 33.

Opportunity Total Price Based on Units

This formula generates proposal pricing based on unit price and total volume.

Unit_price__c * Volume__c * 20

For details about using this operator, see * (Multiply) on page 34.

Professional Services Calculation

This formula estimates professional service fees at an average loaded rate of $1200 per day. Consulting Days is a custom field on opportunities.

Consulting_Days__c * 1200

For details about using this operator, see * (Multiply) on page 34.

Stage-Based Sales Document Selection

This formula Identifies a relevant document in the Documents tab based on opportunity Stage. Use document IDs in the form of “00l30000000j7AO.”

CASE(StageName,

"Prospecting", "Insert 1st Document ID", "Qualification", "Insert 2nd Document ID",

(25)

"Needs Analysis", "Insert 3rd Document ID", "Value Proposition", …

) )

For details about using this function, see CASE on page 42.

Sales Coach

This formula creates a hyperlink that opens a stage-specific document stored in the Documents tab. It uses the previously defined custom formula field that identifies a document based on opportunity Stage. See Stage-Based Sales Document Selection on page 24.

HYPERLINK("/servlet/servlet.FileDownload?file=" & Relevant_Document__c, "View Document in New Window")

For details about using this function, see HYPERLINK on page 51.

Shipping Cost by Weight

This formula calculates postal charges based on weight.

package_weight__c * cost_lb__c

For details about using this operator, see * (Multiply) on page 34.

Shipping Cost Percentage

This formula calculates shipping cost as a fraction of total amount.

Ship_cost__c / total_amount__c

For details about using this operator, see / (Divide) on page 34.

Tiered Commission Rates

This formula calculates the 2% commission amount of an opportunity that has a probability of 100%. All other opportunities will have a commission value of zero.

IF(Probability = 1, ROUND(Amount * 0.02, 2), 0)

For details about using these functions, see IF on page 53 and ROUND on page 80.

Total Contract Value from Recurring and Non-Recurring Revenue

This formula calculates both recurring and non-recurring revenue streams over the lifetime of a contract.

Non_Recurring_Revenue__c + Contract_Length_Months__c * Recurring_Revenue__c

(26)

Pricing

Total Amount

This formula calculates a total amount based on unit pricing and total units.

Unit_price__c * Total_units__c

For details about using this operator, see * (Multiply) on page 34.

User Pricing

This formula calculates a price per user license.

Total_license_rev__c / Number_user_licenses__c For details about using this operator, see / (Divide) on page 34.

Project Management

Calculate Intermediate Milestone from End Date

This formula calculates intermediate milestone dates by subtracting days from the end date (for projects that are planned based on end date).

Release_Date__c - 7 * Phase_duration_in_weeks__c For details about using this operator, see * (Multiply) on page 34.

Scoring Calculations

Lead Scoring

This formula scores leads, providing a higher score for phone calls than website requests.

CASE(LeadSource, "Phone", 2, "Web", 1, 0) For details about using this function, see CASE on page 42.

(27)

Customer Success Scoring

This formula uses a simple scoring algorithm to rank customers a high score for positive survey results in Salesforce.com.

Survey_Question_1__c * 5 + Survey_Question_2__c *2

For details about using these operators, see* (Multiply) on page 34 and + (Add) on page 33.

Operators and Functions

Use the following operators and functions when building formulas. Click on the name or description below to view more details. All functions are available everywhere that you can include a formula such as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.

Note: Extraneous spaces in the samples below are ignored by Salesforce.com.

Math Operators

Description Operator

Calculates the sum of two values. +

Calculates the difference of two values.

-Multiplies its values. *

Divides its values. /

Raises a number to a power of a specified number. ^

Specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All other expressions are evaluated using standard operator precedence.

()

Logical Operators

Description Operator

Evaluates if two values are equivalent. = and ==

Evaluates if two values are not equivalent. <> and !=

Evaluates if a value is less than the value that follows this symbol. <

Evaluates if a value is greater than the value that follows this symbol. >

Evaluates if a value is less than or equal to the value that follows this symbol. <=

Evaluates if a value is greater than or equal to the value that follows this symbol.

(28)

Description Operator

Evaluates if two values or expressions are both true. Use this operator as an alternative to the logical function AND.

&&

Evaluates if at least one of multiple values or expressions is true. Use this operator as an alternative to the logical function OR.

||

Text Operators

Description Operator

Connects two or more strings. &

Date and Time Functions

Description Function

Returns a date value from year, month, and day values you enter. Salesforce.com displays an error on the detail page if

DATE

the value of the DATE function in a formula field is an invalid date, such as February 29 in a non-leap year. Returns a date value for a date/time or text expression.

DATEVALUE

Returns a day of the month in the form of a number between 1 and 31.

DAY

Returns the month, a number between 1 ( January) and 12 (December) in number format of a given date.

MONTH

Returns a date/time representing the current moment.

NOW

Returns the current date as a date data type.

TODAY

Returns the four-digit year in number format of a given date.

YEAR

Informational Functions

Description Function

Determines if an expression has a value and returns a substitute expression if it does not. If the expression has a value, returns the value of the expression.

BLANKVALUE

Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this function returns FALSE.

ISBLANK

Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function returns FALSE.

(29)

Description Function

Determines if an expression is null (blank) and returns a substitute expression if it is. If the expression is not blank, returns the value of the expression.

NULLVALUE

Returns the previous value of a field.

PRIORVALUE

Logical Functions

Description Function

Returns a TRUE response if all values are true; returns a FALSE response if one or more values are false.

AND

Checks a given expression against a series of values. If the expression is equal to a value, returns the corresponding

CASE

result. If it is not equal to any values, it returns the

else_result.

Determines if expressions are true or false. Returns a given value if true and another value if false.

IF

Compares the value of a field to the previous value and returns TRUE if the values are different. If the values are the same, this function returns FALSE.

ISCHANGED

Checks if the formula is running during the creation of a new record and returns TRUE if it is. If an existing record is being updated, this function returns FALSE.

ISNEW

Determines if a text value is a number and returns TRUE if it is. Otherwise, it returns FALSE.

ISNUMBER

Returns FALSE for TRUE and TRUE for FALSE.

NOT

Determines if expressions are true or false. Returns TRUE if any expression is true. Returns FALSE if all expressions are false.

OR

Math Functions

Description Function

Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign.

ABS

Rounds a number up to the nearest integer.

CEILING

Returns a value for e raised to the power of a number you specify.

EXP

Returns a number rounded down to the nearest integer.

(30)

Description Function

Returns the natural logarithm of a specified number. Natural logarithms are based on the constant e value of

2.71828182845904.

LN

Returns the base 10 logarithm of a number.

LOG

Returns the highest number from a list of numbers.

MAX

Returns the lowest number from a list of numbers.

MIN

Returns a remainder after a number is divided by a specified divisor.

MOD

Returns the nearest number to a number you specify, constraining the new number by a specified number of digits.

ROUND

Returns the positive square root of a given number.

SQRT

Text Functions

Description Function

Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does not.

BEGINS

Inserts a line break in a string of text.

BR

Compares two arguments of text and returns TRUE if the first argument contains the second argument. If not, returns FALSE.

CONTAINS

Returns the position of a string within a string of text represented as a number.

FIND

Returns the user’s session ID.

GETSESSIONID

Creates a link to a URL specified that is linkable from the text specified.

HYPERLINK

Inserts an image with alternate text and height/width specifications.

IMAGE

Determines if any value selected in a multi-select picklist field equals a text literal you specify.

INCLUDES

Determines if the value of a picklist field is equal to a text literal you specify.

ISPICKVAL

Returns the specified number of characters from the beginning of a text string.

LEFT

Returns the number of characters in a specified text string.

LEN

Converts all letters in the specified text string to lowercase. Any characters that are not letters are unaffected by this function. Locale rules are applied if a locale is provided.

(31)

Description Function

Inserts spaces or characters you specify to the left-side of a text string.

LPAD

Returns the specified number of characters from the middle of a text string given the starting position.

MID

Returns the specified number of characters from the end of a text string.

RIGHT

Inserts blank spaces or characters that you specify to the right-side of a text string.

RPAD

Substitutes new text for old text in a text string.

SUBSTITUTE

Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also,

TEXT

converts picklist values to text in validation rules, formula fields, and field updates.

Removes the spaces and tabs from the beginning and end of a text string.

TRIM

Converts all letters in the specified text string to uppercase. Any characters that are not letters are unaffected by this function. Locale rules are applied if a locale is provided.

UPPER

Converts a text string to a number.

VALUE

Summary Functions

The following functions can only be used in the context of creating custom summary formulas for summary reports.

Description Function

A summary function that returns the value of the selected summary field from the parent grouping level that you

PARENTGROUPVAL

specify. Parent grouping levels are those above the grouping level where you chose to display the formula. For matrix reports, choose both row and column grouping levels. A summary function that returns the value of the selected summary field from the previous summary row at the

PREVGROUPVAL

grouping level that you specify. For matrix reports, the

summary_field you choose controls whether a previous

row or column is returned. The increment determines how many steps previous to the current summary field to return. The default increment is 1. The maximum increment is 12.

(32)

Advanced Functions

Description Function

Returns an array of strings in the form of record IDs for the selected records in a list, such as a list view or related list.

GETRECORDIDS

Returns content from an s-control snippet. Use this function to reuse common code in many s-controls.

INCLUDE

Returns a relative URL in the form of a link (href and anchor tags) for a custom s-control or Salesforce.com page.

LINKTO

Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it returns FALSE.

REGEX

A regular expression is a string used to describe a format of a string according to certain syntax rules.

Returns a script tag with source for a URL you specify. Use this function when referencing the Force.com AJAX Toolkit or other JavaScript toolkits.

REQUIRESCRIPT

Returns a relative URL for an action, s-control, or a file in a static resource archive in a Visualforce page.

URLFOR

Returns a value by looking up a related value on a custom object similar to the VLOOKUP() Excel function.

VLOOKUP

Encoding Functions

Description Function

Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML, such as

HTMLENCODE

the greater-than sign (>), with HTML entity equivalents, such as &gt;.

Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (\), before unsafe JavaScript characters, such as the apostrophe (').

JSENCODE

Encodes text and merge field values for use in JavaScript within HTML tags by inserting escape characters before

JSINHTMLENCODE

unsafe JavaScript characters and replacing characters that are reserved in HTML with HTML entity equivalents. Encodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such as blank

URLENCODE

spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax. For example, blank spaces are replaced with

(33)

+ (Add)

Calculates the sum of two values. Description:

value1 + value2 and replace each value

with merge fields, expressions, or other numeric values.

Use:

Amount + Maint_Amount__c + Services_Amount__c

This formula calculates the sum of the

opportunity Amount, maintenance amount, and Formula Field Example:

services fees. Note that Maint amount and Service Fees are custom currency fields on opportunities.

EMAIL_OPT_OUT:SUM + DO_NOT_CALL:SUM calculates all Email Opt Out fields plus all Do Report Example:

Not Call fields on the leads in your report. This formula is a number data type that returns a positive integer.

You may have a custom object that allows users to track the total number of hours worked in a Validation Rule Example:

week. Use the following example to ensure that users cannot save a time card record with more than 40 hours in a work week.

Monday_Hours__c + Tuesday_Hours__c + Wednesday_Hours__c + Thursday_Hours__c + Friday_Hours__c > 40

Use a formula like this one in a validation rule to display the following error message when the total number of hours entered for each work day is greater than 40: “Your total hours cannot exceed 40.” This example requires five custom fields on your custom object, one for each day of work.

- (Subtract)

Calculates the difference of two values. Description:

value1 - value2 and replace each value

with merge fields, expressions, or other numeric values.

Use:

Amount - Discount_Amount__c This formula calculates the difference of the opportunity Amount less the Discount Example:

(34)

Amount. Note that Discount Amount is a custom currency field on opportunities. AMOUNT:SUM

-Opportunity.Discount_Amount__c:SUM Report Example:

calculates the difference of all Amount fields and all Discounted Amount custom fields on the opportunities in your report. This formula is a currency data type that returns a currency sign and decimal places.

* (Multiply)

Multiplies its values. Description:

value1 * value2 and replace each value

with merge fields, expressions, or other numeric values.

Use:

Consulting_Days__c * 1200

This formula calculates the number of consulting days times 1200 given that this formula field is Example:

a currency data type and consulting charges a rate of $1200 per day. Note that Consulting Days is a custom field on opportunities. RowCount * AGE:AVG calculates the record count times the average age value of all Report Example:

opportunities in your report. This formula is a number data type that returns a positive or negative integer or decimal.

/ (Divide)

Divides its values. Description:

value1 / value2 and replace each value

with merge fields, expressions, or other numeric values.

Use:

AnnualRevenue/ NumberOfEmployees This formula calculates the revenue amount per employee using a currency field on accounts.

IF(NumberOfOpportunities > 0, NumberOfWonOpportunities / NumberOfOpportunities, null) Example:

This formula calculates the win rate of opportunities on a campaign.

(35)

% Won Opportunities

WON:SUM / RowCount calculates the percent of Won opportunities using a record count Report Example:

representing the number of all opportunities in your report. This formula is a number data type that returns a positive or negative integer. % Difference between Cost and Sales Price (TOTAL_PRICE:SUM - QUANTITY:SUM * Product2.Cost__c:SUM) /

(QUANTITY:SUM *

Product2.Cost__c:SUM) calculates the average percent difference between what a product costs and its selling price on a product-by-product level across many opportunities. Note that

Product2.Cost__c:SUM is a custom currency field named Cost on products, which includes the cost of each product. This formula is a percent data type that returns a positive or negative integer. For best results, use this on a summary Opportunities with Products report that is summarized by Product Name and includes summary totals for Quantity,Total Price, and Cost.

^ (Exponentiation)

Raises a number to a power of a specified number.

Description:

number^integer and replace number with a

merge field, expression, or another numeric Use:

value; replace integer with a merge field that

contains an integer, expression, or any integer. NumberOfEmployees^4 calculates the number of employees to the 4th power.

Example:

ACTIVE:SUM ^ 2 calculates the number of active Salesforce.com users to the 2nd power for Report Example:

administration. This formula is a number data type that returns a positive integer.

Avoid replacing integer with a negative

number. Tips:

() (Open Parenthesis and Close Parenthesis)

Specifies that the expressions within the open parenthesis and close parenthesis are evaluated Description:

(36)

first. All other expressions are evaluated using standard operator precedence.

(expression1) expression2... and

replace each expression with merge fields,

expressions, or other numeric values. Use:

(Unit_Price__c - Standard_Price__c) / Sales_Price__c calculates the difference Example:

between the list price and sales price divided by the sales price. As a percent data type on opportunity products, this calculates the discounted percent.

(DURATIONHOURS:SUM * RowCount) / 24 calculates the duration of all activities times the Report Example:

record count per 24 hours. This formula is a percent data type that returns a positive or negative integer or decimal, representing what percent of a day is spent on activities.

= and == (Equal)

Evaluates if two values are equivalent. Description:

expression1=expression2 or expression1 == expression2, and replace each

Use:

expression with merge fields, expressions, or

other numeric values. Due Date

Due Date = CreatedDate + 5 assigns a due date that is five days past the create date. Example:

Commission Amount IF(Probability =1,

ROUND(Amount*0.02, 2), 0) This formula calculates the 2% commission amount of an opportunity that has a probability of 100%. All other opportunities will have a commission value of 0.

Possible results:

• An opportunity with a Probability of 90% will have a commission of 0. • An opportunity with a Probability of

100% and an Amount of $100,000 will have a commission of $2,000.

(37)

<> and != (Not Equal)

Evaluates if two values are not equivalent. Description:

expression1 <> expression2 or

expression1 != expression2, and replace Use:

each expression with merge fields, expressions, or other numeric values.

IF(Maint_Amount__c +

Services_Amount__c<> Amount, "DISCOUNTED", "FULL PRICE") Example:

This formula displays “DISCOUNTED” on an opportunity if its maintenance amount and services amount do not equal the opportunity amount. Otherwise, displays “FULL PRICE.” Note that this example uses two custom currency fields for Maint Amount and Services Amount.

< (Less Than)

Evaluates if a value is less than the value that follows this symbol.

Description:

value1 < value2 and replace each value with merge fields, expressions, or other numeric values.

Use:

IF(AnnualRevenue < 1000000, 1, 2) assigns the value “1” to accounts with revenues Example:

less than one million and the value “2” to accounts with revenues greater than one million.

> (Greater Than)

Evaluates if a value is greater than the value that follows this symbol.

Description:

value1 > value2 and replace each value

with merge fields, expressions, or other numeric values.

Use:

IF(commission__c > 1000000, "High Net Worth", "General") assigns the “High Example:

Net Worth” value to opportunities with a commission greater than one million. Note, this is a text formula field on opportunities that uses a commission custom field.

(38)

<= (Less Than or Equal)

Evaluates if a value is less than or equal to the value that follows this symbol.

Description:

value1 <= value2 and replace each value with merge fields, expressions, or other numeric values.

Use:

IF(AnnualRevenue <= 1000000, 1, 2) assigns the value “1” to accounts with revenues Example:

less than or equal to one million and the value “2” to accounts with revenues greater than one million.

>= (Greater Than or Equal)

Evaluates if a value is greater than or equal to the value that follows this symbol.

Description:

value1 >= value2 and replace each value with merge fields, expressions, or other numeric values.

Use:

IF(Commission__c >= 1000000, "YES", "NO") assigns the “YES” value to opportunities Example:

with a commission greater than or equal to one million. Note, this is a text formula field on opportunities that uses a custom currency field called Commission.

&& (AND)

Evaluates if two values or expressions are both true. Use this operator as an alternative to the logical function AND.

Description:

(logical1) && (logical2) and replace

logical1 and logical2 with the values or

expressions that you want evaluated. Use:

IF((Price<100 &&

Quantity<5),"Small", null)

This formula displays “Small” if the price is less than 100 and quantity is less than five.

Otherwise, this field is blank. Example:

(39)

|| (OR)

Evaluates if at least one of multiple values or expressions is true. Use this operator as an alternative to the logical function OR. Description:

(logical1) || (logical2) and replace any number of logical references with the values or expressions you want evaluated.

Use:

IF((ISPICKVAL(Priority, "High")) || (ISPICKVAL(Status , "New")),

ROUND(NOW()-CreatedDate, 0), null) This formula returns the number of days a case has been open if the Status is new or the Example:

Priority is high. If the case was opened today, this field displays a zero.

(Discount_Rate__c < 0) || (Discount_Rate__c > 0.40) Validation Rule Example:

This validation rule formula displays the following error message when the Discount Rate custom field is not between 0 and 40%: "Discount Rate cannot exceed 40%."

& (Concatenate)

Connects two or more strings. Description:

string1&string2 and replace each string

with merge fields, expressions, or other values. Use:

"Expense-" & Trip_Name__c & "-" & ExpenseNum__c

This formula displays the text “Expense-” followed by trip name and the expense number. Example:

This is a text formula field that uses an expense number custom field.

ABS

Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign. Description:

ABS(number) and replace number with a merge

field, expression, or other numeric value that has the sign you want removed.

Use:

ABS(ExpectedRevenue) calculates the positive value of the Expected Revenue Example:

(40)

amount regardless of whether it is positive or negative.

AND

Returns a TRUE response if all values are true; returns a FALSE response if one or more values Description:

are false. Use this function as an alternative to the operator && (AND).

AND(logical1,logical2,...) and replace

logical1,logical2,... with the values that

you want evaluated. Use:

IF(AND(Price<1,Quantity<1),"Small", null)

This formula displays “Small” if the price and quantity are less than one. This field is blank if the asset has a price or quantity greater than one. Formula Field Example:

BEGINS

Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does not.

Description:

BEGINS(text, compare_text) and replace

text, compare_text with the characters or

fields you want to compare. Use:

IF(BEGINS (Product_type__c, "ICU"), "Medical", "Technical")

This example returns the text “Medical” if the text in any Product Type custom text field Example:

begins with “ICU.” For all other products, it displays “Technical.”

Tips: • This function is case sensitive so be sure your

compare_text value has the correct

capitalization.

• When using this function in a validation rule or workflow rule, fields that are blank are considered valid. For example, if you have a validation rule that tests to see if the serial number of an asset begins with “3,” all assets that have a blank serial number are

References

Related documents

Select the database field ProjectID with the mouse, and drag it into the formula text window.. In the formula text window, type the sign of equality after the

Sales Inquiry Header Temp Ranges Master Number Item Number Document Type Type ID Document Number Document Date Customer ID Customer Name Phone Number Quote Exp Date Requested Ship

Response DUR/PPS Segment Questions Check Service Billing/Service Rebill Accepted/Rejected If Situational, Payer Situation. This segment is

Consider a bond with a duration of 8 years having a yield to maturity of 8% and interest rates are expected to rise by 50 basis points.. What is the percentage change in the price

Product attributes are one of five types: Checkbox ( true or false ), String (text), Integer (number), Date Field (date) and Float Field (decimal).. Select it (by clicking it

The first part of this study sets the proppant transport, viscosity, and rheological properties of fracturing fluids as the main concerns to define the critical dissolved solid

of one %ear.. T'e follo&amp;in- infor3ation for DC Cororation i rovi*e*.. T'e follo&amp;in- infor3ation for DC Cororation i rovi*e*.. return for t'i fir3..

The mixture was extracted with Et O (3×) and the combined organic extracts were dried (MgSO ), concentrated, and the resulting crude oil was purified by flash chromatography on