Search code examples
excel-formulasumgoogle-sheets-formulastring-formattinggoogle-query-language

Is there a formula that will count the number of terms in a mathematical equation in Google Sheets or Excel?


I use Google Sheets to keep track of how I spend my time at work. One of those tasks is email. I want to know how many times I check my email and how much time it takes out of my day.

Currently if I checked it four times during the day, I enter Email|4 in Column D, and then, e.g. =3+2+5+1 in Column E.

If I want to analyze the cumulative data, the pipe character lets me use a formula to get that "4" out of the cell in D, but I would rather not have to enter it at all.

Is there a formula that will look at the cell in Column E and return the number of terms being added together? So, if E28 is =4+1+2+3+1 it would return "5"?

I will be starting a new job soon and building a new spreadsheet, so I can switch to Excel if that would provide functionality that GSheets doesn't.


Solution

  • try:

    =COLUMNS(SPLIT(A1; "+"))
    

    enter image description here

    or if your cell is 11:

    =COLUMNS(SPLIT(FORMULATEXT(A5), "+"))
    

    enter image description here