Two Formula Tricks πŸ‘€

Quick email!

Last week we talked about quotes as compression algorithms for wisdom.

And discussed how memorizing a few meaningful quotes helps us be better at our jobs.

Well, here is one quote I was thinking about this week:

"I like people admitting they were complete stupid horses’ asses. I know I’ll perform better if I rub my nose in my mistakes. This is a wonderful trick to learn."

β€” Charlie Munger

Why was this one on my mind?

Well, for my entire Salesforce career one of the most frequent formulas I've built into Salesforce Flows is an IF() statement to handle blank values.

The syntax is roughly this:

IF( ISBLANK( fieldName), value_if_blank, fieldName )

If some field or item in the flow is blank, then return a specific value, and if it isn't blank, then use the field.

Students of my flow course will definitely recognize this pattern.

Turns out, there is an existing Salesforce formula that does this exact logical operation.

       

For example:

BLANKVALUE( Payment_Due_Date__c, StartDate + 5)

This formula returns the date five days after the start date whenever Payment Due Date is blank. If Payment Due Date isn't blank, then its value is returned instead.

How could I have missed this?! 

Who knows... but by sharing with you that I did completely miss this one β€” as Charlie says "rubbing my nose in my mistake" β€” I'm hoping I'll improve my future performance!

And a second formula trick I recently learned was that the commonly used ADDMONTHS() formula accepts a negative number as a parameter.

       

Screenshot: subtracting one month from today's date

Turns out the ADDMONTHS() formula is just as useful going back in time as it is going forward.

So to recap:

  • BLANKVALUE() is a formula function that can be used instead of an IF() statement with an ISBLANK() function
  • ADDMONTHS() lets us subtract months too

I was so surprised that I had never used the BLANKVALUE() function before that I remembered the Charlie Munger quote and wanted to share the story with you.

 

Hope one of those two tricks helps!

 

Best,

Nick