@Carol_Stone I assume you are now using COUNTA for a range of cells that all contain numbers/texts/column headers. Let's say C1:Z1, i.e. 24 columns.
You could insert a row (above or below the headers) with a formula using the CELL function. For instance in C3, and copy it across to Z3. This will return the column width for each of the columns. The row may be hidden.
Hidden columns have a width of 0 (zero). Then, in the cell where you want to count the number of visible columns enter this:
The only snag with the CELL function is that you need to recalculate the sheet after you have hidden or unhidden a column for the widths to be updated. So, enter something or press F9.
Not sure if there is another way. Have never had the need to discover one