Help

Re: Formula to modify text not working

Solved
Jump to Solution
1304 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Alba_Machado2
7 - App Architect
7 - App Architect

Happy Friday, Airtable community!

I’ve got a formula that works, but only sometimes. Its purpose is to cut news sources down to just their names, no taglines, no section headings. While it’s a long formula, the sources within it are in alphabetical order so it shouldn’t be too hard to find the ones that are giving me trouble, namely: Al Jazeera, Literary Hub, Mother Jones, Open Culture, Rolling Stone, Slate, Teen Vogue, The A.V. Club, The Guardian, The Intercept, The New York Review of Books, The Progressive, VegNews, and Washington Post. Hoping someone can see a pattern. Here’s the formula:

IF({Source}=
“action’s Email Updates - Tracked Events from GovTrack.us”,
“GovTrack”,
IF({Source}=
“Al Jazeera - Breaking News, World News and Video from Al Jazeera”,
“Al Jazeera”,
IF({Source}=
“Animal welfare | The Guardian”,
“The Guardian”,
IF({Source}=
“AP News - AP Top News”,
“AP News”,
IF({Source}=
“Art and design | The Guardian”,
“The Guardian”,
IF({Source}=
“Article – The Nation”,
“The Nation”,
IF({Source}=
“artnet News”,
“ArtNet”,
IF({Source}=
“Arts & Life : NPR”,
“NPR”,
IF({Source}=
“ArtsJournal”,
“ArtsJournal”,
IF({Source}=
“Artsy News”,
“Artsy News”,
IF({Source}=
“BBC News - US & Canada”,
“BBC News”,
IF({Source}=
“BOOK RIOT”,
“BOOK RIOT”,
IF({Source}=
“Books : NPR”,
“NPR”,
IF({Source}=
“Books | The Guardian”,
“The Guardian”,
IF({Source}=
“BuzzFeed News”,
“BuzzFeed News”,
IF({Source}=
“Catapult”,
“Catapult”,
IF({Source}=
“Chicago Reader”,
“Chicago Reader”,
IF({Source}=
“Chicago Review of Books”,
“Chicago Review of Books”,
IF({Source}=
CNN.com - RSS Channel - HP Hero”,
“CNN”,
IF({Source}=
CNN.com - RSS Channel - US”,
“CNN”,
IF({Source}=
“Color Of Change”,
“Color Of Change”,
IF({Source}=
“Colorlines RSS Feed”,
“Colorlines”,
IF({Source}=
“Colossal”,
“Colossal”,
IF({Source}=
“Crooked Media”,
“Crooked Media”,
IF({Source}=
“Democracy Now!”,
“Democracy Now!”,
IF({Source}=
“Education : NPR”,
“NPR”,
IF({Source}=
“Education Week”,
“Education Week”,
IF({Source}=
“Education | The Guardian”,
“The Guardian”,
IF({Source}=
“Electric Literature”,
“Electric Literature”,
IF({Source}=
“Features – FiveThirtyEight”,
“FiveThirtyEight”,
IF({Source}=
“Feministing”,
“Feministing”,
IF({Source}=
“Here & Now”,
“NPR’s Here & Now”,
IF({Source}=
“HuffPost - Breaking News, U.S. and World News”,
“HuffPost”,
IF({Source}=
“Hyperallergic”,
“Hyperallergic”,
IF({Source}=
“In These Times”,
“In These Times”,
IF({Source}=
“Inside Higher Ed”,
“Inside Higher Ed”,
IF({Source}=
“It’s Nice That”,
“It’s Nice That”,
IF({Source}=
“Juxtapoz Magazine - Juxtapoz Magazine - Home”,
“Juxtapoz”,
IF({Source}=
“Latest Articles”,
“B**** Media”,
IF({Source}=
“Literary Hub”,
“Literary Hub”,
IF({Source}=
“LIVEKINDLY”,
“LIVEKINDLY”,
IF({Source}=
“Longform”,
“Longform”,
IF({Source}=
“Ms. Magazine”,
“Ms. Magazine”,
IF({Source}=
msnbc.com Latest Headlines”,
“msnbc”,
IF({Source}=
“National”,
“Washington Post”,
IF({Source}=
“News : NPR”,
“NPR”,
IF({Source}=
“Newsweek”,
“Newsweek”,
IF({Source}=
“NPR - Music”,
“NPR”,
IF({Source}=
“NYT - Education”,
“New York Times”,
IF({Source}=
“NYT > Arts > Art & Design”,
“New York Times”,
IF({Source}=
“NYT > Books > Book Review”,
“New York Times”,
IF({Source}=
“NYT > Top Stories”,
“New York Times”,
IF({Source}=
“NYT > U.S. News”,
IF({Source}=
“Open Culture”,
“Open Culture”,
IF({Source}=
“PBS NewsHour - Segments”,
“PBS”,
IF({Source}=
“Politico”,
“Politico”,
IF({Source}=
“Politics – Mother Jones”,
“Mother Jones”,
IF({Source}=
“PopMatters”,
“PopMatters”,
IF({Source}=
“POPSUGAR”,
“POPSUGAR”,
IF({Source}=
“Rebecca Solnit | The Guardian”,
“The Guardian”,
IF({Source}=
“Rebecca Solnit – Literary Hub”,
“Literary Hub”,
IF({Source}=
“Rolling Stone”,
“Rolling Stone”,
IF({Source}=
“SAPIENS”,
“SAPIENS”,
IF({Source}=
“Slate - Culture”,
“Slate”,
IF({Source}=
“South Side Weekly”,
“South Side Weekly”,
IF({Source}=
“Story of the Day : NPR”,
“NPR”,
IF({Source}=
“Teen Vogue”,
“Teen Vogue”,
IF({Source}=
“The A.V. Club”,
“The A.V. Club”,
IF({Source}=
“The Atlantic”,
“The Atlantic”,
IF({Source}=
“The Chronicle of Higher Education”,
“The Chronicle of Higher Education”,
IF({Source}=
“The Guardian”,
“The Guardian”,
IF({Source}=
“The Intercept”,
“The Intercept”,
IF({Source}=
“The New York Review of Books”,
“The New York Review of Books”,
IF({Source}=
“The Progressive — A voice for peace, social justice, and the common good”,
“The Progressive”,
IF({Source}=
“US news | The Guardian”,
“The Guardian”,
IF({Source}=
“Vanity Fair”,
“Vanity Fair”,
IF({Source}=
VegNews.com”,
“VegNews”,
IF({Source}=
“World news | The Guardian”,
“The Guardian”))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

1 Solution

Accepted Solutions

^ It looks like that line is missing a companion value.

Make sure your formula is using straight quotes like this " and not curly quotes like this “. Also, if you’re pasting formulas or blocks of code here in the forums (especially something this long) it helps to wrap everything with three backticks (```) on the lines before and after the formula/script.

See Solution in Thread

4 Replies 4

I’m not sure what is causing your issue, but unrelated, I would say this formula is a prime candidate for use of the SWITCH() function:
CleanShot 2020-10-16 at 13.41.26

For your formula, it would start like this:

SWITCH(
   {Source},
   "action’s Email Updates - Tracked Events from GovTrack.us", "GovTrack",
   "Al Jazeera - Breaking News, World News and Video from Al Jazeera", "Al Jazeera",
   "Animal welfare | The Guardian", "The Guardian",
   ...
   ...
   ...
   "No Source OR New Source"
)

You only have to name the “Source” field once, and then follow the pattern of

"what {Source} equals", "what you want to output"

And only one set of parenthesis to keep track of :slightly_smiling_face:

Hi Jeremy,

I get “Sorry, there was a problem saving this field. Please check your formula text” when I try the Switch thing. Maybe I’m not understanding the instructions? Here’s what I put in:

SWITCH({Source},
“action’s Email Updates - Tracked Events from GovTrack.us”,
“GovTrack”,

“Al Jazeera - Breaking News, World News and Video from Al Jazeera”,
“Al Jazeera”,

“Animal welfare | The Guardian”,
“The Guardian”,

“AP News - AP Top News”,
“AP News”,

“Art and design | The Guardian”,
“The Guardian”,

“Article – The Nation”,
“The Nation”,

“artnet News”,
“ArtNet”,

“Arts & Life : NPR”,
“NPR”,

“ArtsJournal”,
“ArtsJournal”,

“Artsy News”,
“Artsy News”,

“BBC News - US & Canada”,
“BBC News”,

“BOOK RIOT”,
“BOOK RIOT”,

“Books : NPR”,
“NPR”,

“Books | The Guardian”,
“The Guardian”,

“BuzzFeed News”,
“BuzzFeed News”,

“Catapult”,
“Catapult”,

“Chicago Reader”,
“Chicago Reader”,

“Chicago Review of Books”,
“Chicago Review of Books”,

CNN.com - RSS Channel - HP Hero”,
“CNN”,

CNN.com - RSS Channel - US”,
“CNN”,

“Color Of Change”,
“Color Of Change”,

“Colorlines RSS Feed”,
“Colorlines”,

“Colossal”,
“Colossal”,

“Crooked Media”,
“Crooked Media”,

“Democracy Now!”,
“Democracy Now!”,

“Education : NPR”,
“NPR”,

“Education Week”,
“Education Week”,

“Education | The Guardian”,
“The Guardian”,

“Electric Literature”,
“Electric Literature”,

“Features – FiveThirtyEight”,
“FiveThirtyEight”,

“Feministing”,
“Feministing”,

“Here & Now”,
“NPR’s Here & Now”,

“HuffPost - Breaking News, U.S. and World News”,
“HuffPost”,

“Hyperallergic”,
“Hyperallergic”,

“In These Times”,
“In These Times”,

“Inside Higher Ed”,
“Inside Higher Ed”,

“It’s Nice That”,
“It’s Nice That”,

“Juxtapoz Magazine - Juxtapoz Magazine - Home”,
“Juxtapoz”,

“Latest Articles”,
“B**** Media”,

“Literary Hub”,
“Literary Hub”,

“LIVEKINDLY”,
“LIVEKINDLY”,

“Longform”,
“Longform”,

“Ms. Magazine”,
“Ms. Magazine”,

msnbc.com Latest Headlines”,
“msnbc”,

“National”,
“Washington Post”,

“News : NPR”,
“NPR”,

“Newsweek”,
“Newsweek”,

“NPR - Music”,
“NPR”,

“NYT - Education”,
“New York Times”,

“NYT > Arts > Art & Design”,
“New York Times”,

“NYT > Books > Book Review”,
“New York Times”,

“NYT > Top Stories”,
“New York Times”,

“NYT > U.S. News”,

“Open Culture”,
“Open Culture”,

“PBS NewsHour - Segments”,
“PBS”,

“Politico”,
“Politico”,

“Politics – Mother Jones”,
“Mother Jones”,

“PopMatters”,
“PopMatters”,

“POPSUGAR”,
“POPSUGAR”,

“Rebecca Solnit | The Guardian”,
“The Guardian”,

“Rebecca Solnit – Literary Hub”,
“Literary Hub”,

“Rolling Stone”,
“Rolling Stone”,

“SAPIENS”,
“SAPIENS”,

“Slate - Culture”,
“Slate”,

“South Side Weekly”,
“South Side Weekly”,

“Story of the Day : NPR”,
“NPR”,

“Teen Vogue”,
“Teen Vogue”,

“The A.V. Club”,
“The A.V. Club”,

“The Atlantic”,
“The Atlantic”,

“The Chronicle of Higher Education”,
“The Chronicle of Higher Education”,

“The Guardian”,
“The Guardian”,

“The Intercept”,
“The Intercept”,

“The New York Review of Books”,
“The New York Review of Books”,

“The Progressive — A voice for peace, social justice, and the common good”,
“The Progressive”,

“US news | The Guardian”,
“The Guardian”,

“Vanity Fair”,
“Vanity Fair”,

VegNews.com”,
“VegNews”,

“World news | The Guardian”,
“The Guardian”
)

^ It looks like that line is missing a companion value.

Make sure your formula is using straight quotes like this " and not curly quotes like this “. Also, if you’re pasting formulas or blocks of code here in the forums (especially something this long) it helps to wrap everything with three backticks (```) on the lines before and after the formula/script.

Alba_Machado2
7 - App Architect
7 - App Architect

Thanks for the eagle eyes, Kamille! And for the SWITCH formula, Jeremy! It worked. Turns out, a couple of holdouts had extra spaces in the original source. It’s all good now. :slightly_smiling_face: