Returns the number of columns in a given reference.
- reference may be given either explicitly (eg A3:B5) or by name (eg myref).
- It is possible to define a name to represent more than one range (eg by entering $A$1:$A$3;$C$1:$C$4 in the Assigned To box of the Insert - Names - Define... dialog). In this case COLUMNS sums the number of columns in each range, irrespective of any duplication of columns.
- returns 2; there are two columns in this range, namely columns A and B.
- returns 2; there are two columns in this range, namely columns G and H.
- returns 1; D8 is interpreted as a one cell range, with a single column (column D).
- where myref has been defined as the multiple range $A$1:$A$3;$C$1:$D$4, returns 3.