Named Functions

COUNTROWS

                    
                        =SUBTOTAL(103, range)/COLUMNS(range)
                    
                

Count the rows that contain data in a range.

Parameters

Function name: COUNTROWS(range)

Function description: Returns the number of rows that contain data in the given range.

Argument placeholders: range -> the range which contains data

Formula definition: =SUBTOTAL(103, range)/COLUMNS(range)

Argument description (range): the range which contains data

Argument example (range): A3:D

As a regular user of Google Sheets, you may have encountered a situation where you need to count the number of rows that contain data in a specific range. While Google Sheets offers several built-in functions, there may not be a function that does exactly what you need. Fortunately, you can create a custom function in Google Sheets to meet your specific needs. In this article, we'll explore how to create a custom function that counts the rows that contain data in a given range.

Function Name and Description

The function we'll create is called COUNTROWS, and it returns the number of rows that contain data in a given range. You can use this function to count the number of rows that contain data in a table, list, or any other range that you specify.

Function Definition

To create the COUNTROWS function in Google Sheets, follow these steps:

  1. In a new or existing spreadsheet, click Data and then Named functions.
  2. Enter the parameters as listed above.
  3. Now you can use this function like you would any other in Google Sheets!

That's it! You've created the COUNTROWS function. Now, you can use it like any other built-in function in Google Sheets.

Function Arguments

The COUNTROWS function has only one argument: range. This argument specifies the range in which you want to count the rows that contain data.

Argument Examples

Here are some examples of how you can use the COUNTROWS function in Google Sheets:

The last example uses the INDEX function to return a reference to the last cell in column A that contains data. The ROWS function then calculates the total number of rows in this reference, which is the number of rows that contain data in the range.

Conclusion

In conclusion, the COUNTROWS function in Google Sheets is a useful tool for counting the number of rows that contain data in a given range. By creating custom functions like this, you can save time and increase your productivity when working with Google Sheets.