Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Count occurences

I've written a quick and easy macro that clears (not delete) a row when it
finds a user prompted date. I now need the macro to run for every occurence
that it can find.
Is there a way to program Excel to count how many times a date appears? I
can then use this count in a loop.
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Count occurences


"AvalancheMike" wrote in message
...
I've written a quick and easy macro that clears (not delete) a row when it
finds a user prompted date. I now need the macro to run for every

occurence
that it can find.
Is there a way to program Excel to count how many times a date appears? I
can then use this count in a loop.
Thanks.


You can use the COUNTIF function.

http://www.mrexcel.com/archive/Dates/30343.html

/Fredrik


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Count occurences

Thanks. I'm familiar with countif, but how do I incorporate countif in a
macro? I know I could have the macro write the formula on the spreadsheet
and gather the information that I need. Then I can delete the formula. But
is there a cleaner way to do this without writing out a formula to the
spreadsheet and then deleting it?


"Fredrik Wahlgren" wrote:


"AvalancheMike" wrote in message
...
I've written a quick and easy macro that clears (not delete) a row when it
finds a user prompted date. I now need the macro to run for every

occurence
that it can find.
Is there a way to program Excel to count how many times a date appears? I
can then use this count in a loop.
Thanks.


You can use the COUNTIF function.

http://www.mrexcel.com/archive/Dates/30343.html

/Fredrik



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count occurences

Dim cnt as Long
cnt = application.Countif(Range("A1:A100"),"3/10/2004")


to demo from the immediate window:
? application.Countif(Range("A1:A100"),"3/10/2004")
3

--
Regards,
Tom Ogilvy


"AvalancheMike" wrote in message
...
I've written a quick and easy macro that clears (not delete) a row when it
finds a user prompted date. I now need the macro to run for every

occurence
that it can find.
Is there a way to program Excel to count how many times a date appears? I
can then use this count in a loop.
Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Count occurences


"AvalancheMike" wrote in message
...
Thanks. I'm familiar with countif, but how do I incorporate countif in a
macro? I know I could have the macro write the formula on the spreadsheet
and gather the information that I need. Then I can delete the formula.

But
is there a cleaner way to do this without writing out a formula to the
spreadsheet and then deleting it?



In that case, use the DATEDIF function
http://www.cpearson.com/excel/datedif.htm

/Fredrik


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
Count Occurences Lmurraz Excel Discussion (Misc queries) 3 July 11th 07 02:46 PM
Count # of Occurences Sweepea Excel Discussion (Misc queries) 6 December 14th 06 02:27 AM
Count Occurences problem anandmr65 Excel Discussion (Misc queries) 4 April 19th 06 05:42 AM
Trying to count occurences if 2 conditions are met NLithgow Excel Worksheet Functions 3 June 8th 05 07:20 AM
I would like to count # of occurences but have it be dynamic when. Sifedirector Excel Worksheet Functions 1 March 19th 05 02:27 PM


All times are GMT +1. The time now is 03:57 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"