PC Review


Reply
Thread Tools Rate Thread

CountIf function refering to another worksheet

 
 
SM
Guest
Posts: n/a
 
      6th Aug 2009
Hi,

I've been fighting with this problem for a while, and tried using examples
from other posts, but I seem to be missing something here!

I have a table set up on Sheet1. The headings contain the Names of the
other worksheets in the workbook (e.g. Sheet2, Sheet3 etc...). The rows
contain peoples' names (e.g. Smith, John etc...). Within each table element
I'm trying to insert a CountIf result that determines how often the name
appears in column S of a given worksheet such as Sheet2.

Here is some sample code I've tried with no success - there are many other
permutations I'll omit.

Cells(j, i) = "=COUNTIF('" & Cells(1, i) & "'!S:S, " & Cells(j, 1) & ")"
where
j = row of the table on Sheet1
i = column of the table on Sheet1
cells(1, i) = name of the worksheet containing the information to be
counted
cells(j,1) = name of the person that is the CountIf argument

Any suggestions to get this to work would be greatly appreaciated!

SM
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      6th Aug 2009
Try the below. You missed the double quotes

Cells(j, i) = "=COUNTIF('" & Cells(1, i) & "'!S:S, """ & Cells(j, 1) & """)"

If this post helps click Yes
---------------
Jacob Skaria


"SM" wrote:

> Hi,
>
> I've been fighting with this problem for a while, and tried using examples
> from other posts, but I seem to be missing something here!
>
> I have a table set up on Sheet1. The headings contain the Names of the
> other worksheets in the workbook (e.g. Sheet2, Sheet3 etc...). The rows
> contain peoples' names (e.g. Smith, John etc...). Within each table element
> I'm trying to insert a CountIf result that determines how often the name
> appears in column S of a given worksheet such as Sheet2.
>
> Here is some sample code I've tried with no success - there are many other
> permutations I'll omit.
>
> Cells(j, i) = "=COUNTIF('" & Cells(1, i) & "'!S:S, " & Cells(j, 1) & ")"
> where
> j = row of the table on Sheet1
> i = column of the table on Sheet1
> cells(1, i) = name of the worksheet containing the information to be
> counted
> cells(j,1) = name of the person that is the CountIf argument
>
> Any suggestions to get this to work would be greatly appreaciated!
>
> SM

 
Reply With Quote
 
SM
Guest
Posts: n/a
 
      6th Aug 2009
Thank you! I had a feeling it had to do with the quotes, but I didn't try
the correct combination you have below.

"Jacob Skaria" wrote:

> Try the below. You missed the double quotes
>
> Cells(j, i) = "=COUNTIF('" & Cells(1, i) & "'!S:S, """ & Cells(j, 1) & """)"
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "SM" wrote:
>
> > Hi,
> >
> > I've been fighting with this problem for a while, and tried using examples
> > from other posts, but I seem to be missing something here!
> >
> > I have a table set up on Sheet1. The headings contain the Names of the
> > other worksheets in the workbook (e.g. Sheet2, Sheet3 etc...). The rows
> > contain peoples' names (e.g. Smith, John etc...). Within each table element
> > I'm trying to insert a CountIf result that determines how often the name
> > appears in column S of a given worksheet such as Sheet2.
> >
> > Here is some sample code I've tried with no success - there are many other
> > permutations I'll omit.
> >
> > Cells(j, i) = "=COUNTIF('" & Cells(1, i) & "'!S:S, " & Cells(j, 1) & ")"
> > where
> > j = row of the table on Sheet1
> > i = column of the table on Sheet1
> > cells(1, i) = name of the worksheet containing the information to be
> > counted
> > cells(j,1) = name of the person that is the CountIf argument
> >
> > Any suggestions to get this to work would be greatly appreaciated!
> >
> > SM

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Function countif Hydra Microsoft Excel Programming 3 15th Sep 2009 04:58 PM
Countif worksheet function frustrations Santa-D Microsoft Excel Worksheet Functions 8 30th Oct 2006 05:14 AM
COUNTIF Worksheet Function John Microsoft Excel Discussion 2 8th Apr 2004 08:18 PM
Countif worksheet function or anything else that will fix my problem dawgy Microsoft Excel Worksheet Functions 1 9th Jan 2004 06:53 PM
Worksheet Function COUNTIF D.S. Microsoft Excel Programming 3 21st Nov 2003 12:28 PM


Features
 

Advertising
 

Newsgroups
 


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