Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Countif a Name occures in a column

Hi all,

I need to count the number of time a name appears in a column and then
save the amount in a cell.

I would like to do this with code as i manipulate the spreadsheet.
I have done it with a countif formular in the cell, nut must one do this
? or is it better to store the total as a variable and then past the
variable into the cell, it is the latter that i am not sure how to do.

Thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Countif a Name occures in a column

Sub CountName ()
Dim numname as Long
Dim namerng as Range

Set namerng as Sheets("Sheet1").Range("A1:A100") 'where your list of
names are located
numname = Application.WorksheetFunction.Countif("Name", namerng)
Sheets("Sheet1").Range("B1"). Value = numname 'puts answer on sheet
End Sub

Mike F
"Tempy" wrote in message
...
Hi all,

I need to count the number of time a name appears in a column and then
save the amount in a cell.

I would like to do this with code as i manipulate the spreadsheet.
I have done it with a countif formular in the cell, nut must one do this
? or is it better to store the total as a variable and then past the
variable into the cell, it is the latter that i am not sure how to do.

Thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Countif a Name occures in a column

Sub CountNames()
MyName = "Alan"
Set Myrng = Range("A1:A10000")
NameCount = Application.CountIf(Myrng, MyName)
MsgBox NameCount
Range("B1") = Application.CountIf(Myrng, MyName) ' or Range("B1")=NameCount
End Sub


"Tempy" wrote:

Hi all,

I need to count the number of time a name appears in a column and then
save the amount in a cell.

I would like to do this with code as i manipulate the spreadsheet.
I have done it with a countif formular in the cell, nut must one do this
? or is it better to store the total as a variable and then past the
variable into the cell, it is the latter that i am not sure how to do.

Thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Countif a Name occures in a column

Thanks all for the input.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Countif a Name occures in a column

Sub Foo()
cnum = Application.CountIf(Range("C:C"), "*" & Test & "*")
Range("A1").Value = cnum
End Sub



"Tempy" wrote in message
...
Hi all,

I need to count the number of time a name appears in a column and then
save the amount in a cell.

I would like to do this with code as i manipulate the spreadsheet.
I have done it with a countif formular in the cell, nut must one do this
? or is it better to store the total as a variable and then past the
variable into the cell, it is the latter that i am not sure how to do.

Thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Countif a Name occures in a column

Could you please give me some more advice on this topic.

I need to look for 19 different names and put the totals in a column. Is
it possible to have a list of names, perhaps in my Personal.xls
workbook, and with the code find the results for one name, paste it and
then get the next name, until the end of the list ?


Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF: 2 criteria: Date Range Column & Text Column MAC Excel Worksheet Functions 14 September 16th 08 04:39 PM
CountIf using every other column duketter Excel Discussion (Misc queries) 3 February 6th 08 06:52 PM
countif column d equals x and column a noblank Willie Wilson Excel Worksheet Functions 4 January 5th 08 10:22 PM
countif Column A and excule column B if it's cancelled LLWest Excel Worksheet Functions 4 October 31st 06 10:47 PM
How do I Excel countif column a =? and column b = null ? tiff Excel Worksheet Functions 1 November 30th 05 12:29 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"