Skip to content

Instantly share code, notes, and snippets.

@TehBrian
Last active April 27, 2020 16:00
Show Gist options
  • Save TehBrian/bda387d24c1add35b44ff32073be66f8 to your computer and use it in GitHub Desktop.
Save TehBrian/bda387d24c1add35b44ff32073be66f8 to your computer and use it in GitHub Desktop.
Nice little formulas I use in Google Sheets.
This little string sets the cell to the amount of words in another cell, relative to that cell.
I don't know why this was so hard to find, I feel like it should be easier than this, but whatever.
Replace "-2" with however many to the left or right you want to go in that column, or use row, or whatever.
=IF(INDIRECT(ADDRESS(ROW(), COLUMN()-2))="", "", COUNTA(SPLIT(INDIRECT(ADDRESS(ROW(), COLUMN()-2)), " ")))
This thing puts the first word of the cell to the left by one, you can change the numbers as usual.
=IF(INDIRECT(ADDRESS(ROW(), COLUMN()-1))="", "", LEFT(INDIRECT(ADDRESS(ROW(), COLUMN()-1)), FIND(" ", INDIRECT(ADDRESS(ROW(), COLUMN()-1)))-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment