# Number of columns in Google Sheets

Friends, please tell me, is there any way to calculate the Number of columns with information in Google Sheets?

Thank you!

If you want to determine how many columns have data out of a total number of columns, then youâ€™d need to loop through the columns and check every cell. But thereâ€™s probably an easier way to do that using Google Sheets formulas.

But if Iâ€™m understanding your question correctly, the hard part is knowing if ANY data exists in a particular column. It would be relatively easy to sort each column alphabetically and check for blank entries at the top (or bottom) but if your columns have different lengths and/or you have columns where many of the cells are empty but some have data, that wonâ€™t really work.

Edit: It looks like the ISBLANK() function would work especially because it allows for ranges. So you could check each column using that function and store the results somewhere in your sheet and then have Thunkable check those resulting values.

Edit #2: I just tried using the ISBLANK function to see if two empty cells were blank but ISBLANK(E1:E2) returns FALSE. So Iâ€™m not convinced that function can use a range of cells.

Edit #3: Okay, that link I included above says that you have to wrap the ISBLANK function in another function like this:

`=ARRAYFORMULA(ISBLANK(E1:E2))`

That will produce these results:

And then to clean things up, constrain the array size to a single row like this:

`=array_constrain(arrayformula(isblank(E1:E2)),1,1)`

Which gives you a single row result:

1 Like

Aha! You can also use the simpler CountA() function. It will tell you the number of values in a column:

`=CountA(E1:E2)`

1 Like

I am trying to implement a rating system.
After that I get the value of the first and second cell and get the average.

In details:

1. You need to add a value to cell (for example) A1 (first user)
2. The second user adds a value to cell B1
3. And so on ad infinitum
4. I get the value of cell A1, B1, get the average value â€¦

Tnuyukable allows the entire string, and I have a problem: how to add values â€‹â€‹alternately to A1, B1, and so on â€¦
sorry for the â€ścrookedâ€ť text - English is not my native language.

You should be using rows for this, not columns. Thunkable is designed to get row data, to check number of rows, etc. Itâ€™s going to be much harder to do this with columns.

Each user should have their own row, not their own column.

2 Likes

Yes, you are absolutely right - this will be the right solution, which is quite simple to implement. Thanks for the tip!

1 Like