Reputation: 41
I have a google sheet and in 'column A' I have list of fruit names. I want to find and replace 5 types of fruits with code names
"Mango" to be replaced with "001" "Apple" to be replaced with "002" "Orange" to be replaced with "003" "Banana" to be replaced with "004" "Jackfruit" to be replaced with "005"
I have a formula to replace just one of the word. Below is the formula
=ARRAYFORMULA(REGEXREPLACE(Sheet1!A:A, "Mango", "001"))
How do I combine the formula to replace all fruits with code words?
Upvotes: 1
Views: 112
Reputation: 9345
If it were me, I'd just use SWITCH:
=ArrayFormula(IFERROR(SWITCH(A:A,"mango","001","apple","002","orange","003","banana","004","jackfruit","005"),A:A))
Upvotes: 1