ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   count data (https://www.excelbanter.com/excel-programming/331311-count-data.html)

diesel

count data
 
if and if only two difrent data are found in cells on the same raw will be
counted if not will move to the next raw and so on

like the word "window" and the word "open" are found on the same raw it will
be counted if not it wil move to the next raw and so on how can it be done

then ill get the number of times that these data were found togather in
single raw in the data sheet

Toppers

count data
 
Hi,
Something along these lines ....

Sub x()

Dim r As Long
Dim rng As Range

For r = 2 To 10 ' Loop through rows .....
lastcol = Cells(r, Columns.Count).End(xlToLeft).Column
Set rng = Range(Cells(r, 1), Cells(r, lastcol))
If Application.CountIf(rng, "window") 0 And Application.CountIf(rng,
"open") Then
MsgBox "Add my code"
' increment your count ....
End If
Next r

End Sub

HTH

"diesel" wrote:

if and if only two difrent data are found in cells on the same raw will be
counted if not will move to the next raw and so on

like the word "window" and the word "open" are found on the same raw it will
be counted if not it wil move to the next raw and so on how can it be done

then ill get the number of times that these data were found togather in
single raw in the data sheet


Toppers

count data
 
Slight error ...

If Application.CountIf(rng, "window") 0 And Application.CountIf(rng,
"open") 0 Then


"Toppers" wrote:

Hi,
Something along these lines ....

Sub x()

Dim r As Long
Dim rng As Range

For r = 2 To 10 ' Loop through rows .....
lastcol = Cells(r, Columns.Count).End(xlToLeft).Column
Set rng = Range(Cells(r, 1), Cells(r, lastcol))
If Application.CountIf(rng, "window") 0 And Application.CountIf(rng,
"open") Then
MsgBox "Add my code"
' increment your count ....
End If
Next r

End Sub

HTH

"diesel" wrote:

if and if only two difrent data are found in cells on the same raw will be
counted if not will move to the next raw and so on

like the word "window" and the word "open" are found on the same raw it will
be counted if not it wil move to the next raw and so on how can it be done

then ill get the number of times that these data were found togather in
single raw in the data sheet



All times are GMT +1. The time now is 01:41 PM.

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