Yesterday we had the COLUMN function, and today we have the COLUMNS function. COLUMNS takes a range and returns the number of columns there are in that range. It looks like this:-
It’s really that simple. Use a range (either a reference or named) as the criteria and COLUMNS will return the number of columns:-
And, just so you get it, here’s another:-
Got it? Good. COLUMNS can also be used to count the number of columns in an array of values. Obviously these aren’t columns like those found in cells, but the function returns the same. If, for example you typed:-
You have asked the COLUMNS function to count how many ‘columns’ of data there are in the array (defined within the curly brackets). In the example above, the comma symbols separate the columns and the semicolon the ‘rows’ of the array. Pressing the enter key will return a value of 4, as you’d expect. I’ll post about arrays at a future time, so you don’t have to worry too much about them for now if what I’ve just said doesn’t make sense.