CELLCOUNT

CELLCOUNT(Array,Info_Type)
Array
Required. Range to find cell count.
Info_Type
0 or ignored☛ total cell count, 1☛ row count, or 2☛ column count

Returns the total cell count, total row count, or total column count of a given range.

schardt679

Board Regular
Joined
Mar 27, 2021
Messages
58
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Returns the total cell count, total row count, or total column count of a given range.

Excel Formula:
=LAMBDA(Array,Info_Type,
      LET(Arr, Array&"",    Info, Info_Type,    InfoScan, AND(Info<>{2,1,0}),    InfoMSG, "Info_Type=0,1,2",
          RowCt, ROWS(Arr),   ColCt, COLUMNS(Arr),    TotalCells, RowCt*ColCt,
          Result, SWITCH(Info,  1, RowCt,  2, ColCt,  TotalCells),    Return, IF(InfoScan, InfoMSG, Result),
      Return)
  )
CELLCOUNT
Returns total cells, rows, or columns of a range as a number
Total cells= 0 or ingnored; total rows= 1; or total columns= 2
Returns a number corresponding to the above
RangeResult
128
34
56
78
Total cell count is returned
=CELLCOUNT(B7#,)
RangeResult
124
34
56
78
Total row count is returned
=CELLCOUNT(B18#, 1)
RangeResult
122
34
56
78
Total column count is returned
=CELLCOUNT(B29#, 2)
 
Upvote 0
I updated this function slightly. Cells with errors and blanks are handled, even if the range is all errors or blanks. All other functionality is the same as above. See below.

Returns the total cell count, total row count, or total column count of a given range.

Optional arguments require comma to work. Calls AVALUE
Other functions on minisheet: AFORMULATEXT.

Excel Formula:
=LAMBDA(Array,Info_Type,
      LET(Arr, AVALUE(Array,,,),          Info, Info_Type,
             InfoScan, AND(Info<>{2,1,0}),          InfoMSG, "Info_Type=0,1,2",
             RowCt, ROWS(Arr),          ColCt, COLUMNS(Arr),          TotalCells, RowCt*ColCt,
             Result, SWITCH(Info,  1, RowCt,  2, ColCt,  TotalCells),
             Return, IF(InfoScan, InfoMSG, Result),
             Return
      )
  )
LAMBDA Examples.xlsx
BCDE
36RangeResult
37#REF!1
38
39Total cell count is returned
40Formula in cell E37☛ =CELLCOUNT(B37,)
CELLCOUNT
Cell Formulas
RangeFormula
E37E37=CELLCOUNT(B37,)
B40B40=AFORMULATEXT(E37)
 

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top