Best answer

Extracting last letters of a word using the Formatter

  • 1 May 2021
  • 5 replies
  • 1732 views

Userlevel 1

The Truncate function returns the first letters of a word etc. But we need the last two letters of a string (ZIP-codes) to be returned. I guess we need a spreadsheet-like formula in zapier that returns text. Who can help?

 

Example: when people submit:

1074XP : we want as a return value: XP

1055 DR: we want as a return value: DR

5678   XX: we want as a return value: XX

 

icon

Best answer by Troy Tessalone 1 May 2021, 16:36

View original

5 replies

Userlevel 7
Badge +14

Hi @Angelo Spiler 

Give this trick a try with the Formatter > Text > Truncate option

TIP: Set the Skip Characters to -2 which will return characters from the end of (right side) of the string.

See example step configured below along with the output.

 

Userlevel 7
Badge +14

@Angelo Spiler

FYI: There is a Formatter > Math > Spreadsheet Style Formula option: https://zapier.com/help/create/format/understand-spreadsheet-style-formula-functions

Userlevel 7
Badge +14

@Angelo Spiler 

Here’s how to use a Code step with JavaScript to get the last 2 characters from a string

 

Userlevel 1


Excellent. First solution works fine and is sufficient. Thanks! Is there a place where I can find tricks like minus 2 etc.? The help-information of Zapier website is rather elementary.

Userlevel 7
Badge +14

@Angelo Spiler 

Best shot at finding tricks/tips is these places:

  1. Zapier Community: https://community.zapier.com/
  2. Zapier Blog: https://zapier.com/blog/
  3. Zapier App Help Articles
  4. Open a Ticket with Zapier Support: https://zapier.com/app/get-help
  5. GSearches on the topic

Reply