Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

SEO Keyphrase Word Count Formula

Topic Labels: Formulas
Solved
Jump to Solution
1883 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrew_Roche
4 - Data Explorer
4 - Data Explorer

So I’m looking to employ a formula to provide a word count for my SEO keyphrases, which range from 2 to 8 words. Below is the formula that I thought would work, but I’ve had no such luck…does anyone have any thoughts as to what’s going on here? Thank you in advance!

IF(({Keyphrase}=BLANK()),0,(LEN({Keyphrase}) - LEN(SUBSTITUTE({Keyphrase},’ ', ‘ ’))+1))

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

The formula that Justin provided will give you the number of comma separated items. Is your {Keyphrase} a comma separated list? Or is it a single phrase with a variable word count?

If it is a single phrase (no commas), and you want a word count of all the words in the field, you should remove the spaces instead of the commas.

IF(
  Keyphrase, 
  LEN(Keyphrase) - LEN(SUBSTITUTE(Keyphrase, " ", "")) + 1, 
  0
)

See Solution in Thread

6 Replies 6

Welcome to the community, @Andrew_Roche! :grinning_face_with_big_eyes: There are a few issues with the formula you wrote. First all, all quotes need to be non-styled quotes. The forum automatically styles quotes in normal text, which is why it’s preferred to format formulas using the preformatted text option. This can be done by selecting the formula and clicking the preformatted text icon: </> When properly formatted, quotes should be straight vertical quotes, not slanted or curly. Airtable won’t recognize the latter type.

It also looks like you’ve got an extra level of parentheses around your condition check, which is likely causing part of the problem. The beginning portion should look like this:

IF({Keyphrase}=BLANK(), ...

However, you can simplify the way you look for the {Keyphrase} field’s contents by only listing the field name:

IF(FieldName, result_if_true, optional_result_if_false)

Anything in that field is equivalent to true, and an empty field is equivalent to false.

With that applied and the parentheses and quote issues fixed, this should work:

IF(Keyphrase, LEN(Keyphrase) - LEN(SUBSTITUTE(Keyphrase, ",", "")) + 1, 0)

Hey @Justin_Barrett - Thank you for the response. However, the formula is still yielding a result of 1 across the board…thoughts?

kuovonne
18 - Pluto
18 - Pluto

The formula that Justin provided will give you the number of comma separated items. Is your {Keyphrase} a comma separated list? Or is it a single phrase with a variable word count?

If it is a single phrase (no commas), and you want a word count of all the words in the field, you should remove the spaces instead of the commas.

IF(
  Keyphrase, 
  LEN(Keyphrase) - LEN(SUBSTITUTE(Keyphrase, " ", "")) + 1, 
  0
)
Andrew_Roche
4 - Data Explorer
4 - Data Explorer

Thank you, @K_V!

Thanks for the follow-up. I must admit, the different quote types in the original formula confused me. I thought it was just malformed and that the text was a comma-separated list.

Mwinobog
4 - Data Explorer
4 - Data Explorer

 I've dealt with similar issues before. It looks like you're close to the solution. Try this:
scssCopy code
IF({Keyphrase}=""", 0, LEN({Keyphrase}) - LEN(SUBSTITUTE({Keyphrase}, " ", """)) + 1)
I hope this helps you count those SEO keyphrases effectively! Also, you could use this service (www.pixelocity.com) to do all SEO jobs for you. Good luck!