Skip to main content

SF-0078 · Concept · Easy

What is a formula field?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

A formula field is a custom field whose value isn’t stored — it’s computed every time a record is read, using an expression you supply in Salesforce’s formula language. The result is read-only for users, recalculated automatically, and never sits on the database row the way a regular field does.

What you can build with one

  • A derived label, e.g. Account.Name & " — " & Industry
  • A calculation, e.g. Amount - Discount__c
  • A cross-object lookup that surfaces a parent’s value on the child, e.g. Account.Owner.Email on a Contact
  • A conditional flag, e.g. IF(Amount > 100000, "Strategic", "Standard")
  • An image URL rendered as an icon (using the IMAGE() function)

Why interviewers ask

Formula fields are the canary in the coal mine for over-engineering. A candidate who reaches for a workflow or a trigger to set a value that never needs to be edited has missed the cheapest, safest tool on the platform. The interviewer wants to hear: “Formula first, automation second, code last.”

Quick anatomy

IF(
  ISBLANK(Close_Date__c),
  "Open",
  IF(Close_Date__c < TODAY(), "Overdue", "Scheduled")
)

Return type is declared up front (Text, Number, Date, Checkbox, Currency, Percent), and the expression must evaluate to that type. The compiler is strict — you cannot return a Text in one branch and a Number in another.

Common pitfalls

  • They’re not searchable the same way stored fields are. SOQL can filter on them, but indexed lookups are limited.
  • Cross-object formulas have a depth limit of 5 levels via lookup/master-detail relationships.
  • Some field types can’t be referenced — Long Text Area, Encrypted, and a few others. See Which type of fields cannot be used in the formula field?
  • Performance matters in reports and list views when the formula touches many parent records.

Common follow-ups

  • What is the maximum character limit? — 3,900 characters of compiled formula. See the next question.
  • What are the return types? — Checkbox, Currency, Date, Date/Time, Number, Percent, Text, Time.
  • Difference between ISBLANK() and ISNULL()? — Covered separately.

Verified against: Salesforce Help — Formula Field Reference, Trailhead module Formula Fields. Last reviewed 2026-05-17 for Spring ‘26 release.