Keyword Density, but only for a certain part of a page

What I need to do is pull the keyword density of the main content of a page. Using https://www.theguardian.com/world/2021/aug/02/covid-travel-minister-defends-plan-amber-watchlist-england as an example, I need the density of the main copy.

I can get either of these things into Excel with the below, but I need to find a way to combine them:

  • =XPathOnUrl("https://www.theguardian.com/world/2021/aug/02/covid-travel-minister-defends-plan-amber-watchlist-england","//*[@id='maincontent']")
  • =KeywordDensity("https://www.theguardian.com/world/2021/aug/02/covid-travel-minister-defends-plan-amber-watchlist-england")

Any help is much appreciated

Thanks, that's a great suggestion to analyze keyword density on part of a page.

I've created a custom build which allows the KeywordDensity function to accept string inputs as well as URLs.

So, this should work:
=KeywordDensity(XPathOnUrl("https://www.theguardian.com/world/2021/aug/02/covid-travel-minister-defends-plan-amber-watchlist-england","//*[@id='maincontent']"))

ooh, thanks so much. Are you planning on building this in to the main version?

Sure, if it works as intended, hence the custom build for testing (which is the same as main version with the new Keyword Density function)

Sorry for the late response, this works perfectly, thanks so much :slight_smile:

1 Like