ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Countif (https://www.excelbanter.com/excel-programming/365549-countif.html)

Busybee

Countif
 
Here is the statement I am using.

For Each ce In Range("a2:a" & Cells(Rows.Count, 1).End(xlUp).Row)
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"), ce.Value)
Next ce

However the data in Range k:k is actually on a different sheet. How do I get
it to look on sheet "Data Sheet" range k:k. Column a2:a is on sheet "Sales
Reps". Thanks

Chip Pearson

Countif
 
Change
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
to
ce.Offset(0, 1) =
WorksheetFunction.CountIf(Worksheets("Sheet2").Ran ge("k:k"),
ce.Value)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Busybee" wrote in message
...
Here is the statement I am using.

For Each ce In Range("a2:a" & Cells(Rows.Count,
1).End(xlUp).Row)
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
Next ce

However the data in Range k:k is actually on a different sheet.
How do I get
it to look on sheet "Data Sheet" range k:k. Column a2:a is on
sheet "Sales
Reps". Thanks




Busybee

Countif
 
Thanks a ton Chip! Truly a lifesaver!

"Chip Pearson" wrote:

Change
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
to
ce.Offset(0, 1) =
WorksheetFunction.CountIf(Worksheets("Sheet2").Ran ge("k:k"),
ce.Value)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Busybee" wrote in message
...
Here is the statement I am using.

For Each ce In Range("a2:a" & Cells(Rows.Count,
1).End(xlUp).Row)
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
Next ce

However the data in Range k:k is actually on a different sheet.
How do I get
it to look on sheet "Data Sheet" range k:k. Column a2:a is on
sheet "Sales
Reps". Thanks





Busybee

Countif
 
ok. im having a problem now.
if those cells match then i need it to count the corresponding cells in
sheet "data sheet" col BW that contain a 1.

"Chip Pearson" wrote:

Change
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
to
ce.Offset(0, 1) =
WorksheetFunction.CountIf(Worksheets("Sheet2").Ran ge("k:k"),
ce.Value)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Busybee" wrote in message
...
Here is the statement I am using.

For Each ce In Range("a2:a" & Cells(Rows.Count,
1).End(xlUp).Row)
ce.Offset(0, 1) = WorksheetFunction.CountIf(Range("k:k"),
ce.Value)
Next ce

However the data in Range k:k is actually on a different sheet.
How do I get
it to look on sheet "Data Sheet" range k:k. Column a2:a is on
sheet "Sales
Reps". Thanks






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

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