Skip to main content

From this:


animals > cat > face > eyes


into


Animals/Cat/Face/Eyes



how can i do that i know the first step:



SUBSTITUTE({Category 1}, ’ > ', ‘/’) // this replaces the > into /


and then how can i use the upper case method only for the first letter of every word?


thanks for the help


please write an example code, thanks!

Long story short, Airtable’s formulas won’t let you do what you want. You need the ability to iterate through a collection and perform a specific operation on each item in that collection, which can’t currently happen with existing formula tools.



Depending on how you’re getting the original string, though, you might be able to do the first-letter capitalization elsewhere in the process. Are you receiving the source string (animals > cat > face > eyes) from an external source, or somewhere else in the same base?



EDIT: Not sure why I said it’s not possible. It can be done, but it’s going to take a collection of formulas.


Long story short, Airtable’s formulas won’t let you do what you want. You need the ability to iterate through a collection and perform a specific operation on each item in that collection, which can’t currently happen with existing formula tools.



Depending on how you’re getting the original string, though, you might be able to do the first-letter capitalization elsewhere in the process. Are you receiving the source string (animals > cat > face > eyes) from an external source, or somewhere else in the same base?



EDIT: Not sure why I said it’s not possible. It can be done, but it’s going to take a collection of formulas.


Yes i received only this: animals > cat > face > eyes


Yes i received only this: animals > cat > face > eyes


From a external source


In that case your only options are to either do the capitalization in that external source before it gets to Airtable, or to use some form of integration—either custom code that uses the API, or a tool like Zapier or Integromat—to process the text.


In that case your only options are to either do the capitalization in that external source before it gets to Airtable, or to use some form of integration—either custom code that uses the API, or a tool like Zapier or Integromat—to process the text.






Airtable: Organize anything you can imagine





Airtable works like a spreadsheet but gives you the power of a database to organize anything. Sign up for free.


















this doc can write 3 words automatically Big 😛






Airtable: Organize anything you can imagine





Airtable works like a spreadsheet but gives you the power of a database to organize anything. Sign up for free.


















this doc can write 3 words automatically Big 😛


but i dont understand the full code…


but i dont understand the full code…


I can’t see the formulas in that base because it’s shared as read-only, so I’m afraid I can’t help.


Looking deeper, methinks that’s a product of @W_Vann_Hall. Perhaps he can shed some light on this situation.


That link doesn’t open up a specific base. It just takes me to my own workspace page.


That link doesn’t open up a specific base. It just takes me to my own workspace page.



Modifying that setup to work in your situation is definitely doable, though the biggest issue you need to consider is how many pieces you need to capitalize. Will it always be 4, or could there be more in some cases? If more, what’s the maximum number of pieces?


Modifying that setup to work in your situation is definitely doable, though the biggest issue you need to consider is how many pieces you need to capitalize. Will it always be 4, or could there be more in some cases? If more, what’s the maximum number of pieces?


3-8 words


example 1: nonfiction > nature > animal rights



example 2: nonfiction > technology & engineering > agriculture > animal husbandry > Test


3-8 words


example 1: nonfiction > nature > animal rights



example 2: nonfiction > technology & engineering > agriculture > animal husbandry > Test


Based on those samples, which output do you want?



Option 1: only capitalize the first word in each section


example 1: Nonfiction/Nature/Animal rights


example 2: Nonfiction/Technology & engineering/Agriculture/Animal husbandry/Test



…OR…



Option 2: capitalize all words


example 1: Nonfiction/Nature/Animal Rights


example 2: Nonfiction/Technology & Engineering/Agriculture/Animal Husbandry/Test



I’ve got some thoughts on how to simplify the setup in that example base you shared that will make Option 1 a little easier. Option 2 is a lot more complex because each subsection needs individual words capitalized, including logic to find those words with or without separators.


3-8 words


example 1: nonfiction > nature > animal rights



example 2: nonfiction > technology & engineering > agriculture > animal husbandry > Test


Here’s a version that outputs Option 1 based on my description above, and supports up to 8 sections.






i need to capitalize all Words 🙂 )




i need to capitalize all Words 🙂 )


can you send me the code?


I will love you so much!


Here’s a link to a test base where I built the setup shown above:







I’m afraid that I don’t have time to delve into this more deeply to create Option 2. By studying this version and the one made by @W_Vann_Hall you can probably figure out how to capitalize all words in each part.



Personally, though, I would enlist the help of external tools. For example, Zapier has a “Code by Zapier” app where you can write custom code that operates on zap data. Make a zap that takes the data from your source, processes it to capitalize all words (hint: use the .title() string method in Python) and change the separators (hint: use the .split() and .join() Python string methods), then feed the data into Airtable. Or pull the data from Airtable, process it, then replace the old version with the capitalized version.


Here’s a link to a test base where I built the setup shown above:







I’m afraid that I don’t have time to delve into this more deeply to create Option 2. By studying this version and the one made by @W_Vann_Hall you can probably figure out how to capitalize all words in each part.



Personally, though, I would enlist the help of external tools. For example, Zapier has a “Code by Zapier” app where you can write custom code that operates on zap data. Make a zap that takes the data from your source, processes it to capitalize all words (hint: use the .title() string method in Python) and change the separators (hint: use the .split() and .join() Python string methods), then feed the data into Airtable. Or pull the data from Airtable, process it, then replace the old version with the capitalized version.


This could now be done with the new scripting block as well. It would require manually running the script whenever new data needs to be processed, but it keeps everything inside Airtable if that’s your preference.


@airtableManuel You can do this with this formula:



REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({YOUR FIELD NAME}, "^a", "A"), "^b", "B"), "^c", "C"), "^d", "D"), "^e", "E"), "^f", "F"), "^g", "G"), "^h", "H"), "^i", "I"), "^j", "J"), "^k", "K"), "^l", "L"), "^m", "M"), "^n", "N"), "^o", "O"), "^p", "P"), "^q", "Q"), "^r", "R"), "^s", "S"), "^t", "T"), "^u", "U"), "^v", "V"), "^w", "W"), "^x", "X"), "^y", "Y"), "^z", "Z"), " a", " A"), " b", " B"), " c", " C"), " d", " D"), " e", " E"), " f", " F"), " g", " G"), " h", " H"), " i", " I"), " j", " J"), " k", " K"), " l", " L"), " m", " M"), " n", " N"), " o", " O"), " p", " P"), " q", " Q"), " r", " R"), " s", " S"), " t", " T"), " u", " U"), " v", " V"), " w", " W"), " x", " X"), " y", " Y"), " z", " Z")


@airtableManuel You can do this with this formula:



REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({YOUR FIELD NAME}, "^a", "A"), "^b", "B"), "^c", "C"), "^d", "D"), "^e", "E"), "^f", "F"), "^g", "G"), "^h", "H"), "^i", "I"), "^j", "J"), "^k", "K"), "^l", "L"), "^m", "M"), "^n", "N"), "^o", "O"), "^p", "P"), "^q", "Q"), "^r", "R"), "^s", "S"), "^t", "T"), "^u", "U"), "^v", "V"), "^w", "W"), "^x", "X"), "^y", "Y"), "^z", "Z"), " a", " A"), " b", " B"), " c", " C"), " d", " D"), " e", " E"), " f", " F"), " g", " G"), " h", " H"), " i", " I"), " j", " J"), " k", " K"), " l", " L"), " m", " M"), " n", " N"), " o", " O"), " p", " P"), " q", " Q"), " r", " R"), " s", " S"), " t", " T"), " u", " U"), " v", " V"), " w", " W"), " x", " X"), " y", " Y"), " z", " Z")


It’s possible to cut that formula nearly in half. Instead of searching for each letter twice—once at the start of the string, and again at the start of a word—search for both combinations at the same time. Here’s an example just using “a”:



REGEX_REPLACE({Field Name}, "^a| a", " A")



Expand that out to cover the rest of the alphabet, then trim the result to get rid of any leading space:



TRIM(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({Field Name}, "^a| a", " A"), "^b| b", " B"), "^c| c", " C"), "^d| d", " D"), "^e| e", " E"), "^f| f", " F"), "^g| g", " G"), "^h| h", " H"), "^i| i", " I"), "^j| j", " J"), "^k| k", " K"), "^l| l", " L"), "^m| m", " M"), "^n| n", " N"), "^o| o", " O"), "^p| p", " P"), "^q| q", " Q"), "^r| r", " R"), "^s| s", " S"), "^t| t", " T"), "^u| u", " U"), "^v| v", " V"), "^w| w", " W"), "^x| x", " X"), "^y| y", " Y"), "^z| z", " Z"))



Too bad that Airtable’s regex variant doesn’t support the \U substitution token. That will replace a given item with its uppercase equivalent, which would make it possible to shrink that formula down to this:



REGEX_REPLACE(Words, "(^.| .)","\\U$1")



To be clear, that last formula WILL NOT WORK in Airtable. It’s just wishful thinking.


Reply