Countif

G

Guest

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
 
C

Chip Pearson

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


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

Guest

Thanks a ton Chip! Truly a lifesaver!

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


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

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top