COLUMN Function in Google Sheets: Tips and Tricks

Published on

The COLUMN function returns the column number of a specified cell in Google Sheets. When used with ArrayFormula, it can handle cell ranges. The first column, column A, is numbered 1.

This function can be used as part of other functions, particularly with the ADDRESS function. It also plays a major role in conditional formatting, allowing you to dynamically refer to cells in another sheet. We’ll explore tips and tricks related to these uses.

Syntax

COLUMN([cell_reference])

The function has only one argument, cell_reference, which is optional. If omitted, the default reference is the cell containing the formula.

For example, if you enter =COLUMN() in cell A1 or anywhere in column A, it will return 1. If you enter it in column Z, it will return 26.

If cell_reference is a range, you should enter it as an array formula:

=ArrayFormula(COLUMN(A1:Z1))

This will return the column numbers 1 to 26. You can use this formula in any cell, provided there are 26 blank cells across.

Here are some tips and tricks for using the COLUMN function in Google Sheets.

Using the COLUMN Function with the ADDRESS Function

As you may know, a cell address is identified by its column letter and row number. For example, B10 refers to the cell at the intersection of column B and row 10.

If you specify row and column numbers, the ADDRESS function can return the cell address.

For example, the following formula will return B10:

=ADDRESS(10, 2)

Here, 10 is the row number, and 2 is the column number.

Tricky Use:

If you enter the following formula in any cell and drag it across, it will return $A$1, $A$2, $A$3, and so on across the row:

=ADDRESS(COLUMN(A1), 1)

Try replacing COLUMN(A1) with COLUMN(A1) + 10 and see what happens. Also, replace 1 with 2 and try again.

Using the COLUMN Function in Conditional Formatting

Assume you want to highlight a particular value, such as the current date, in a cell range (e.g., A1:Z).

You can select A1:Z and apply the following formula by clicking Format > Conditional Formatting and selecting Custom Formula Is:

=A1=TODAY()

But what should you do when you want to highlight a different sheet? For example, if you want to match today’s date in the range A1:Z in Sheet1 and highlight the same cells in Sheet2 instead of Sheet1.

You can’t use a formula like =Sheet1!A1=TODAY() in Sheet2, as Google Sheets doesn’t support direct cell references when referring to a different sheet in conditional formatting.

In this case, you need to use the INDIRECT function, like this:

=INDIRECT("Sheet1!A1")=TODAY()

However, the issue with this approach is that the cell reference is not dynamic because it’s a string. To make it dynamic, you can use the following formula:

=INDIRECT(ADDRESS(ROW(A1), COLUMN(A1), 4, ,"Sheet1"))=TODAY()

Here, we used the ROW and COLUMN functions within the ADDRESS function to dynamically refer to each corresponding cell in Sheet1 from Sheet2.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

Rank per Group in Excel

You have two groups of 20 students each. How do you determine the rank...

Real-Time Excel Filtering Using Combo Box & FILTER Function

In this tutorial, you’ll learn how to set up real-time Excel filtering using a...

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

More like this

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

How to Extract Top N from Aggregated Query Results in Google Sheets

To summarize data in Google Sheets, you can use the QUERY function. However, if...

How to Use RANK IF in Google Sheets (Conditional Ranking)

You can use the RANK function to rank values in an entire dataset. But...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.