Skip to main content

Command Palette

Search for a command to run...

๐Ÿงฎ Day 4: Formula Fields & Calculations

Published
โ€ข7 min read
๐Ÿงฎ Day 4: Formula Fields & Calculations
C

I am a senior software developer with extensive experience in leading teams and building complex web platforms, including educational and healthcare-focused applications. I have demonstrated deep technical expertise in backend development, AI integration, and cloud technologies, which is further evidenced by my peer-reviewed publications in real-time object detection and AI. My work has earned recognition through citations and contributions to platforms indexed in Google Scholar and ResearchGate. Beyond my technical roles, I am actively involved in mentorship through ADPList and serve as an Alumni Advisory Board Member for the Generation Initiative, showcasing my commitment to advancing digital skills and cloud technology.

What I Built Today

Today I focused on automating calculations by implementing 8 formula fields across my Housing Operations system. Formula fields are powerful because they automatically calculate values based on other fields, eliminating manual data entry and ensuring accuracy.

The 8 Formula Fields:

  1. Property Age โ€“ Calculates how old a property is

  2. Tenancy Duration Days โ€“ Calculates how long a tenancy has lasted

  3. Tenancy Status Indicator โ€“ Visual emoji indicator for tenancy status

  4. Repair SLA Status โ€“ Checks if repair was completed within SLA

  5. Days to Repair Deadline โ€“ Calculates days remaining to meet SLA

  6. Rent Arrears Risk Level โ€“ Categorizes arrears (Low/Medium/High)

  7. Vulnerability Review Overdue โ€“ Flags overdue reviews (checkbox)

  8. Property Full Address โ€“ Concatenates address fields into one


Key Learnings

1. What Are Formula Fields?

Formula fields are read-only fields that automatically calculate their value based on other fields, expressions, or values. They update in real-time whenever the underlying data changes.

Key characteristics:

  • Automatic โ€“ No manual data entry required

  • Dynamic โ€“ Updates when source fields change

  • Read-only โ€“ Users cannot edit them directly

  • Efficient โ€“ No storage space used (calculated on-the-fly)


2. Formula Return Types

Formulas can return different data types:

Number โ€“ For calculations (e.g., Property Age, Days to Deadline)

YEAR(TODAY()) - Year_Built__c

Text โ€“ For concatenation or conditional text (e.g., SLA Status, Full Address)

IF(Actual_Completion_Date__c <= Target_Completion_Date__c, "โœ… Met SLA", "โŒ Missed SLA")

Checkbox โ€“ For TRUE/FALSE conditions (e.g., Review Overdue)

TODAY() - Review_Date__c > 90

Date/DateTime โ€“ For date calculations (not used in today's examples, but possible)


3. Formula Functions I Mastered

IF() โ€“ Conditional Logic

IF(condition, value_if_true, value_if_false)

Example:

IF(ISBLANK(End_Date__c), TODAY() - Start_Date__c, End_Date__c - Start_Date__c)

If End Date is blank, calculate from today. Otherwise, calculate total duration.

CASE() โ€“ Multiple Conditions

CASE(expression, value1, result1, value2, result2, default_result)

Example:

CASE(TEXT(Tenancy_Status__c), "Active", "๐ŸŸข Active", "Ended", "๐Ÿ”ด Ended", "โšช Unknown")

Cleaner than nested IFs for simple value matching.

ISBLANK() โ€“ Check for Empty Fields

ISBLANK(field_name)

Returns TRUE if field is empty, FALSE if it has a value.

TODAY() โ€“ Current Date

TODAY()

Returns today's date. Useful for age/duration calculations.

YEAR() โ€“ Extract Year from Date

YEAR(date_field)

Extracts the year from a date field.

& (Ampersand) โ€“ Text Concatenation

text1 & text2

Joins text strings together.

Example:

Address__c & ", " & City__c & ", " & Postcode__c

Result: "123 Main Street, Bradford, BD1 1AA"


4. The 8 Formula Fields Explained

Formula 1: Property Age

Object: HOA_Property__c Return Type: Number

Formula:

YEAR(TODAY()) - Year_Built__c

Why it matters:

  • Helps prioritize maintenance for older properties

  • Useful for portfolio age distribution reporting

  • Supports strategic planning for property upgrades

Example: If Year Built = 2000 and current year = 2025, Property Age = 25


Formula 2: Tenancy Duration Days

Object: HOA_Tenancy__c Return Type: Number

Formula:

IF(ISBLANK(End_Date__c), TODAY() - Start_Date__c, End_Date__c - Start_Date__c)

Why it matters:

  • Tracks tenancy length for reporting

  • Identifies long-term vs. short-term tenancies

  • Useful for turnover analysis

Example:

  • Active tenancy (no end date): Days since start

  • Ended tenancy: Total duration in days


Formula 3: Tenancy Status Indicator

Object: HOA_Tenancy__c Return Type: Text

Formula:

CASE(TEXT(Tenancy_Status__c), "Active", "๐ŸŸข Active", "Ended", "๐Ÿ”ด Ended", "Notice Given", "๐ŸŸก Notice Given", "โšช Unknown")

Why it matters:

  • Quick visual scanning of tenancy status

  • Improves user experience on list views

  • Makes dashboards more intuitive


Formula 4: Repair SLA Status

Object: HOA_Repair_Request__c Return Type: Text

Formula:

IF(ISBLANK(Actual_Completion_Date__c), "In Progress", IF(Actual_Completion_Date__c <= Target_Completion_Date__c, "โœ… Met SLA", "โŒ Missed SLA"))

Why it matters:

  • Instant visibility into SLA performance

  • Critical for board reporting

  • Identifies contractors who miss deadlines


Formula 5: Days to Repair Deadline

Object: HOA_Repair_Request__c Return Type: Number

Formula:

IF(ISBLANK(Actual_Completion_Date__c), Target_Completion_Date__c - TODAY(), NULL)

Why it matters:

  • Helps prioritize urgent repairs

  • Negative values flag overdue items

  • Supports proactive backlog management

Example:

  • Target is 5 days away: Shows 5

  • Target was 2 days ago: Shows -2 (overdue)


Formula 6: Rent Arrears Risk Level

Object: HOA_Tenancy__c Return Type: Text

Formula:

IF(Rent_Arrears__c = 0, "โœ… No Arrears", IF(Rent_Arrears__c <= 500, "๐ŸŸก Low Risk", IF(Rent_Arrears__c <= 1500, "๐ŸŸ  Medium Risk", "๐Ÿ”ด High Risk")))

Why it matters:

  • Helps finance team prioritize collections

  • Visual indicators make reports actionable

  • Supports risk-based arrears management

Risk Levels:

  • ยฃ0: No Arrears

  • ยฃ1-ยฃ500: Low Risk

  • ยฃ501-ยฃ1500: Medium Risk

  • ยฃ1500+: High Risk


Formula 7: Vulnerability Review Overdue

Object: HOA_Vulnerability__c Return Type: Checkbox

Formula:

IF(ISBLANK(Review_Date__c), TODAY() - Identified_Date__c > 90, TODAY() - Review_Date__c > 90)

Why it matters:

  • Critical for safeguarding compliance

  • Easy to filter in reports (checked = overdue)

  • Prevents regulatory violations

Logic: Flags as overdue if more than 90 days since last review (or identification if never reviewed)


Formula 8: Property Full Address

Object: HOA_Property__c Return Type: Text

Formula:

Address__c & ", " & City__c & ", " & Postcode__c

Why it matters:

  • Simplifies address display in reports

  • Reduces need for multiple address columns

  • Improves readability

Example Output: "123 Main Street, Bradford, BD1 1AA"


Screenshots

  1. Property Age Formula Setup

  2. Tenancy Duration Days Formula Setup

  3. Tenancy Status Indicator Formula Setup

  4. SLA Status Formula Setup

  5. Days to Deadline Formula Setup

  6. Arrears Risk Level Formula Setup

  7. Review Overdue Formula Setup

  8. Full Address Formula Setup

  9. Property Record with Formulas

  10. Repair Request Record with Formulas


Challenges I Faced

1. Nested IF Statements

Getting the parentheses balanced in nested IF statements was tricky at first. I learned to:

  • Work from the inside out

  • Test each condition separately

  • Use proper indentation (even though Salesforce doesn't require it)

2. Date Arithmetic

Understanding that subtracting dates in Salesforce returns the number of days was key. Also learned that:

  • TODAY() returns a Date (no time component)

  • Date fields can be subtracted directly

  • Result is always in days

3. CASE vs. Nested IF

Learned when to use CASE (simple value matching) vs. nested IF (complex conditions). CASE is cleaner for:

  • Checking a single field against multiple values

  • Returning different results for each match

4. Formula Return Types

Had to think carefully about return types:

  • Use Checkbox for TRUE/FALSE conditions (easier to filter)

  • Use Text for visual indicators with emojis

  • Use Number for calculations that might be used in other formulas


Real-World Impact for Incommunities

These 8 formula fields will:

Operational Efficiency

  • Eliminate manual calculations โ€“ No more calculating property age or tenancy duration by hand

  • Real-time insights โ€“ SLA status and days to deadline update automatically

  • Reduce errors โ€“ Automated calculations are always accurate

Compliance & Risk Management

  • Safeguarding compliance โ€“ Review Overdue checkbox ensures no vulnerability is forgotten

  • Financial risk visibility โ€“ Arrears Risk Level helps prioritize collections

  • SLA tracking โ€“ Instant visibility into repair performance

Reporting & Decision-Making

  • Better dashboards โ€“ Visual indicators (emojis, colors) make data easier to scan

  • Accurate metrics โ€“ Automated calculations ensure consistent reporting

  • Proactive management โ€“ Negative "Days to Deadline" flags overdue repairs immediately

User Experience

  • Cleaner interface โ€“ Full Address field reduces clutter

  • Intuitive status indicators โ€“ Emojis provide instant understanding

  • Less data entry โ€“ Users don't need to calculate or enter these values


What I Learned About the Salesforce Admin Role

Today's work directly aligns with the Salesforce Administrator role at Incommunities:

From the Job Spec:

"Configure Salesforce to meet business requirements"

How formula fields deliver this:

  • Translate business logic into automated calculations

  • Reduce manual work for end users

  • Ensure data consistency across the platform

From the Job Spec:

"Create and maintain reports and dashboards"

How formula fields deliver this:

  • Provide calculated fields for reporting (e.g., SLA Status, Arrears Risk Level)

  • Enable visual indicators that make dashboards more effective

  • Support KPI tracking (e.g., % of repairs meeting SLA)

From the Job Spec:

"Ensure data quality and integrity"

How formula fields deliver this:

  • Eliminate manual calculation errors

  • Ensure consistent logic across all records

  • Provide real-time, accurate data for decision-making


Tomorrow: Day 5

I'll dive into Security & Access โ€“ understanding profiles, permission sets, role hierarchy, and sharing settings to control who sees and does what in Salesforce! ๐Ÿ”’

This is critical for ensuring data privacy and compliance in a housing association context.


Resources


Progress Tracker

โœ… Day 1: Data Modeling & ERD

โœ… Day 2: Custom Objects & Fields

โœ… Day 3: Data Quality & Validation Rules

โœ… Day 4: Formula Fields & Calculations

โฌœ Day 5: Security & Access

โฌœ Day 6: Automation (Flow)

โฌœ Day 7: Reports & Dashboards

โฌœ Day 8: Data Management

โฌœ Day 9: Integration Basics

โฌœ Day 10: Final Project & Review


Follow my journey:

#Salesforce #SalesforceAdmin #LearningInPublic #Day4 #FormulaFields #Automation #HousingAssociation