Count cells from entire column that contain text
This tutorial shows how to count cells from a single column that contain text (cells that are text values) through the use of an Excel formula or VBA
Example: Count cells from entire column that contain text
=COUNTIF(C:C,"*")
|
The formula uses the Excel COUNTIF function, with the asterisk (*) sign as the criteria, to count the number of cells that contain text in the selected column (C).
|
Sub Count_cells_from_entire_column_that_contain_text()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count the number of cells in a single column that contain text
ws.Range("E5") = Application.WorksheetFunction.CountIf(ws.Range("C:C"), "*")
ws.Range("E5") = Application.WorksheetFunction.CountIf(ws.Range("C:C"), "*")
End Sub
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("E5") in the VBA code.
Column Reference: Select the column that you want to count from by changing the range reference ("C:C") in the VBA code.
Output Range: Select the output range by changing the cell reference ("E5") in the VBA code.
Column Reference: Select the column that you want to count from by changing the range reference ("C:C") in the VBA code.
EXPLANATION
This tutorial shows and explains how to count cells from a single column that contain text (cells that are text values) using an Excel formula and VBA.
Excel Method: Both the Excel and VBA methods make use of the COUNTIF function and selecting an entire column, with the asterisk (*) sign as the criteria, to count cells from a single column that contain text. In this example, the formula counts the cells that contain text from column C.
FORMULA
=COUNTIF(column_reference, "*")
=COUNTIF(column_reference, "*")
ARGUMENTS
column_reference: The column from which you want to count the cells that have text.
"*": Using "*", as the criteria, will count all of the cells in the selected range that are populated with text.
column_reference: The column from which you want to count the cells that have text.
"*": Using "*", as the criteria, will count all of the cells in the selected range that are populated with text.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Count cells from entire column that contain value | How to count cells from a single column that contain a value using Excel and VBA methods | |
Count cells from entire column that contain numbers | How to count cells from a single column that contain numbers (cells that are numeric values) using Excel and VBA methods | |
Count cells from multiple columns that contain value | How to count cells from multiple columns that contain a value using Excel and VBA methods | |
Count cells if greater than | How to count cells that are greater than a specific value using Excel and VBA methods | |
Count cells if less than | How to count cells that are less than a specific value using Excel and VBA methods |
RELATED FUNCTIONS
Related Functions | Description | Related Functions and Description |
---|---|---|
COUNTIF Function | The Excel COUNTIF function returns the number of cells in a range that meet a specified criteria |