ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   count instance (https://www.excelbanter.com/excel-worksheet-functions/200710-count-instance.html)

Brad

count instance
 
Thanks for taking the time to read my question.

I have a list of computer models and I'd like to have totals at the bottom
of each kind using a formula.


A
1 Laptop
2 Desktop
3 Server
4 Laptop
5 Desktop
6 Desktop
7 Laptop

So my formula would look at column A rows 1 to 7

Total Laptops = 3 (calculated value, not static value)
Total Desktops = 3 (calculated value, not static value)
Total Servers = 1 (calculated value, not static value)

I was thinking of an array, but I'm not sure how to do that, or if it is the
correct approach.

Thanks again for your help,

Brad

Brad

count instance
 
{=SUM(IF(A1:A7="Desktop",1,0))}

Is what I used and it worked.

Brad

"Brad" wrote:

Thanks for taking the time to read my question.

I have a list of computer models and I'd like to have totals at the bottom
of each kind using a formula.


A
1 Laptop
2 Desktop
3 Server
4 Laptop
5 Desktop
6 Desktop
7 Laptop

So my formula would look at column A rows 1 to 7

Total Laptops = 3 (calculated value, not static value)
Total Desktops = 3 (calculated value, not static value)
Total Servers = 1 (calculated value, not static value)

I was thinking of an array, but I'm not sure how to do that, or if it is the
correct approach.

Thanks again for your help,

Brad


Duke Carey

count instance
 
Assuming each cell contains JUST the words you show, you should use

=COUNTIF(A1:a7,"Laptop") and repeat for the other 2 types

if the cells could contain characters in addition to "Laptop", etc, then

=SUMPRODUCT(--NOT(ISERR(SEARCH("Laptop",A1:A100))))

"Brad" wrote:

Thanks for taking the time to read my question.

I have a list of computer models and I'd like to have totals at the bottom
of each kind using a formula.


A
1 Laptop
2 Desktop
3 Server
4 Laptop
5 Desktop
6 Desktop
7 Laptop

So my formula would look at column A rows 1 to 7

Total Laptops = 3 (calculated value, not static value)
Total Desktops = 3 (calculated value, not static value)
Total Servers = 1 (calculated value, not static value)

I was thinking of an array, but I'm not sure how to do that, or if it is the
correct approach.

Thanks again for your help,

Brad


Brad

count instance
 
Hey that's great!! Better than what I found.

Thanks Duke

Brad

"Duke Carey" wrote:

Assuming each cell contains JUST the words you show, you should use

=COUNTIF(A1:a7,"Laptop") and repeat for the other 2 types

if the cells could contain characters in addition to "Laptop", etc, then

=SUMPRODUCT(--NOT(ISERR(SEARCH("Laptop",A1:A100))))

"Brad" wrote:

Thanks for taking the time to read my question.

I have a list of computer models and I'd like to have totals at the bottom
of each kind using a formula.


A
1 Laptop
2 Desktop
3 Server
4 Laptop
5 Desktop
6 Desktop
7 Laptop

So my formula would look at column A rows 1 to 7

Total Laptops = 3 (calculated value, not static value)
Total Desktops = 3 (calculated value, not static value)
Total Servers = 1 (calculated value, not static value)

I was thinking of an array, but I'm not sure how to do that, or if it is the
correct approach.

Thanks again for your help,

Brad



All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com