Counting the number of cells on an array of cells.

Solid_Gabriel

New Member
Joined
Mar 27, 2011
Messages
8
Ok, here's the thing: I have this worksheet, filled with informations about hundreds of equipments, where each one of then occupies a single row. Each row has several informations in some columns, and one of those informations is an alphanumeric code, for example XYZ1A. There are 4 codes like that in total, and I need to count how many devices of each one I have.

I was filtering the worksheet by selecting only the specific code I wanted on the respective column, and trying to use one of the default functions to count the number of cells on that column that had that exact code. But It wasn't working, because it was counting the total number of rows, and not just that specific number of rows I selected.

I mean, there's like a total of 400 rows, begining at row 3 and going up untill 403, for example. When I filtered the list, only some of the rows would appear (let's say, 200 in total) and then I would select all the values that appeared on the column "I", where I was writing the code, and use the function to count how many cells I had selected. But what I got as the result was 400 cells, instead of just the 200 that had the code. So I would like to know what I'm doing wrong.

I was using the 2007 version, but also want it to work on 2003, if possible.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Do either of these formulas work for you: =SUBTOTAL(2,C3:C403) or =SUBTOTAL(3,C3:C403)

Using the Subtotal function is handy when trying to sum or count filtered data.
 
Upvote 0
Hi and welcome to the board!!!
Have you considered ussing a Pivot Table (my choice) or SUMPRODUCT
Code:
=SUMPRODUCT(--(I3:I403="XYZ1A"))

lenze
 
Upvote 0
Hi and welcome to the board!!!
Have you considered ussing a Pivot Table (my choice) or SUMPRODUCT
Code:
=SUMPRODUCT(--(I3:I403="XYZ1A"))
lenze

No, I haven't tried that. I was trying the default functions on the menu bar, but they weren't working for me.

I'm gonna try using your function now to see if it works.

EDIT: The SUMPRODUCT function worked very well. Thank you.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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