Count of specif cell in multiple column

manoj_arsul

Board Regular
Joined
Jun 27, 2018
Messages
61
I want a program for below data

filter to condition1 for use , then condition2 for use & then for condition3 for use

Room No Condition 1 Condition 2 Condition 3
1 Use Use Use
2 Not in Use Use Not in Use
3 Use Use Use
4 Not in Use Use Not in Use
5 Use Not in Use Not in Use
6 Use Not in Use Use
7 Use Use Use
8 Use Use Use
9 Not in Use Not in Use Use
10 Not in Use Use Not in Use



Room No Condition 1 Condition 2 Condition 3
1 Use Use Use
3 Use Use Use
7 Use Use Use
8 Use Use Use


Out put : 4
 
Last edited by a moderator:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,

If you're just looking for the count when All 3 Columns are "Use":


Book1
ABCD
1Room NoCondition 1Condition 2Condition 3
21UseUseUse
32Not in UseUseNot in Use
43UseUseUse
54Not in UseUseNot in Use
65UseNot in UseNot in Use
76UseNot in UseUse
87UseUseUse
98UseUseUse
109Not in UseNot in UseUse
1110Not in UseUseNot in Use
12
13
14Output4
Sheet74
Cell Formulas
RangeFormula
B14=COUNTIFS(B2:B11,"Use",C2:C11,"Use",D2:D11,"Use")
 
Upvote 0
Cell Count of : filter multiple columns for one value

Hi ,

Can any one send me code for count of below condition . Row data is in sheet2

Filter to column A for "Present" , Filter column B to "Present" , Filter column C to "Present" ,


Row Data Is below:


A B C
Present in AD Present in AV Present in SCCM
Present in AD Present in AV Not Present in SCCM
Present in AD Not Present in AV Not Present in SCCM
Not Present in AD Present in AV Present in SCCM
Present in AD Present in AV Present in SCCM
Not Present in AD Not Present in AV Not Present in SCCM
Present in AD Present in AV Present in SCCM
Present in AD Present in AV Present in SCCM
Present in AD Not Present in AV Not Present in SCCM

filter to present in all these 3 column :


A B C
Present in AD Present in AV Present in SCCM
Present in AD Present in AV Present in SCCM
Present in AD Present in AV Present in SCCM
Present in AD Present in AV Present in SCCM


Out put in next sheet1 in cell A1 = ( ANS is = 4 )
 
Last edited by a moderator:
Upvote 0
Re: Cell Count of : filter multiple columns for one value

With your data sheet looking as follows BEFORE processing -- Except Add Column Notation "Select?" in Cell D1
Excel 2010
ABCD
ABCselect?
Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVNot Present in SCCM
Present in ADNot Present in AVNot Present in SCCM
Not Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVPresent in SCCM
Not Present in ADNot Present in AVNot Present in SCCM
Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVPresent in SCCM
Present in ADNot Present in AVNot Present in SCCM

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]

</tbody>
Sheet1



Run the Macro (Below):

Code:
Sub Foo()
Range("A1").Select
Range("D2:D10000").ClearContents
Set MySelect = Range("A2:C2")    '**Your Current Mask Selection**
Set MyData = MySelect.CurrentRegion
Set MyData = MyData.Offset(1).Resize(MyData.Rows.Count - 1)
For i = MyData.Row To MyData.Rows.Count + 1
    If Cells(i, 1) = MySelect(1) And _
       Cells(i, 2) = MySelect(2) And _
       Cells(i, 3) = MySelect(3) Then
    Cells(i, 4) = "YES"
    End If
Next i
With Range("A1").CurrentRegion
    .AutoFilter Field:=4, Criteria1:="<>"
End With
End Sub

to Produce:

Excel 2010
ABCD
ABCselect?
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]8[/TD]

[TD="align: center"]9[/TD]

</tbody>
Sheet1
 
Upvote 0
Re: Cell Count of : filter multiple columns for one value

Hi @Fluff

Sorry , I was not able to elaborate last que .

I want how many rooms having all 3 ( AD , AV , SCCM ) are present

For Data :

A B C
Room No
101 Present in AD Present in AV Present in SCCM
102 Present in AD Present in AV Not Present in SCCM
103 Present in AD Not Present in AV Not Present in SCCM
104 Not Present in AD Present in AV Present in SCCM
105 Present in AD Present in AV Present in SCCM
106 Not Present in AD Not Present in AV Not Present in SCCM
107 Present in AD Present in AV Present in SCCM
108 Present in AD Present in AV Present in SCCM
109 Present in AD Not Present in AV Not Present in SCCM

After filter 3 columns like A - Present in AD B-Present in AV C-Present in SCCM

Room No A B C
101 Present in AD Present in AV Present in SCCM
105 Present in AD Present in AV Present in SCCM
107 Present in AD Present in AV Present in SCCM
108 Present in AD Present in AV Present in SCCM

Out Put (ANS) = First column Count 4
 
Last edited by a moderator:
Upvote 0
Re: Cell Count of : filter multiple columns for one value

With your data sheet looking as follows BEFORE processing -- Except Add Column Notation "Select?" in Cell D1
Excel 2010
ABCD
ABCselect?
Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVNot Present in SCCM
Present in ADNot Present in AVNot Present in SCCM
Not Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVPresent in SCCM
Not Present in ADNot Present in AVNot Present in SCCM
Present in ADPresent in AVPresent in SCCM
Present in ADPresent in AVPresent in SCCM
Present in ADNot Present in AVNot Present in SCCM

<tbody>
[TD="align: center"]1
[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8
[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]

</tbody>
Sheet1



Run the Macro (Below):

Code:
Sub Foo()
Range("A1").Select
Range("D2:D10000").ClearContents
Set MySelect = Range("A2:C2")    '**Your Current Mask Selection**
Set MyData = MySelect.CurrentRegion
Set MyData = MyData.Offset(1).Resize(MyData.Rows.Count - 1)
For i = MyData.Row To MyData.Rows.Count + 1
    If Cells(i, 1) = MySelect(1) And _
       Cells(i, 2) = MySelect(2) And _
       Cells(i, 3) = MySelect(3) Then
    Cells(i, 4) = "YES"
    End If
Next i
With Range("A1").CurrentRegion
    .AutoFilter Field:=4, Criteria1:="<>"
End With
End Sub

to Produce:

Excel 2010
ABCD
ABCselect?
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES
Present in ADPresent in AVPresent in SCCMYES

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]6
[/TD]

[TD="align: center"]8
[/TD]

[TD="align: center"]9[/TD]

</tbody>
Sheet1

Thank u @ jim may
Program is also running right but I want only for Present . Your program is running (selected) for both Present & Not
 
Upvote 0
Re: Cell Count of : filter multiple columns for one value

@manoj_arsul
In future please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.

I have merged both threads
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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