count depending on...

Mike7

Board Regular
In column M I need to do count of three cells in the range B2K7. The range B1K1 - numbers of columns, where 1 is number for column B, 2 - for column C, etc. The range O2Q2 - numbers of columns I need to count.
I would like to automate it in the following way: when I put numbers of columns in range O2Q2 then in column M matching column letters will be counted.
Also O2Q2 numbers could be in one cell separated by comma.
Thanks.
Book1.xls
ABCDEFGHIJKLMNOPQR
112345678910
21245693259
321378100
43123781
544569102
651578101
76234692
8
Sheet1

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try this formula in M2 copied down

=COUNT(INDEX(B2:K2,O\$2),INDEX(B2:K2,P\$2),INDEX(B2:K2,Q\$2))

Works good.
Big thanks.

It will be:

SUM(IF(HLOOKUP(O\$2,\$B:\$K,\$A2+1,FALSO)<>"",1,),IF(HLOOKUP(P\$2,\$B:\$K,\$A2+1,FALSE)<>"",1,),IF(HLOOKUP(Q\$2,\$B:\$K,\$A2+1,FALSE)<>"",1,))

I restarted my computer and meantime is arrived barry houdini.
My compliments for the elegance of your formula.

I could not get it working before I turned Italian "Falso" to English "False"
Big thanks too!

Replies
16
Views
362
Replies
4
Views
134
Replies
4
Views
110
Replies
3
Views
327
Replies
5
Views
337

1,217,498
Messages
6,136,998
Members
450,037
Latest member
Tao86

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.

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

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