Skip to main content

Find and Replace "spaces" Script

  • September 27, 2021
  • 2 replies
  • 81 views

Hi I have a price field that I auto import prices from and it comes out as “7 99” because that’s how this specific website shows the price. I want to use the find and replace script to replace the spaces " " with a period “.” however that doesn’t work. Idk code but should this fix be done in my data scraping or can airtable fix it.

2 replies

Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • October 2, 2021

This can be done with a formula:

SUBSTITUTE({Price Field}, " ", ".")

If you want to turn that into an actual decimal number, wrap that in the VALUE() function:

VALUE(SUBSTITUTE({Price Field}, " ", "."))

Be sure to set the field formatting to display decimal values.


Bill_Felix
Forum|alt.badge.img+9
  • Inspiring
  • 18 replies
  • October 2, 2021

Because you mentioned scraping

Here is another Formula that might come in handy:

REGEX_REPLACE(TRIM({example of scraped text}), '\\s','.')

So this does two important things:

  1. It trims or removes the whitespace that might be dragged along from the scraping process (very common in my experience)
  2. uses the \s regex:
    \s matches any whitespace character (equivalent to [\r \n \t \f \v])