How to write a macro that counts the number of columns that contain data and prints the result at the bottom of the list?
For example, if the data is:
|1|2|3|
|a| | |
|1| |3|
The final table would be:
|1|2|3|
|a| | |
|1| |3|
|=|=|=|
|3|1|2|
libreoffice-calc
How to write a macro that counts the number of columns that contain data and prints the result at the bottom of the list?
For example, if the data is:
|1|2|3|
|a| | |
|1| |3|
The final table would be:
|1|2|3|
|a| | |
|1| |3|
|=|=|=|
|3|1|2|
Best Answer
There are different approaches:
Use
COUNTIF()
, comparing the rows range with an empty string:use
COUNTBLANK()
and subtract the result from the sum of rows:In both cases, just enter the formula in A4 and drag it to the right, LO Calc will adapt the cell references automatically.