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

Hi,

Need help in writing a macro that gives me a count of occurances of
one string based on the occurance of another string.

Here is what I want.

I have Employees in column A and their vacation dates in B . I need to
write a macro which reports out the count of employees who have
applied for vacation in 2005, 2006 and 2007.

XYZ 12/1/2005
abc 3/1/2006
def 2/1/2007

My excel contains almost 500 rows and I need to write a macro to get
the count based on the year.

Thanks,
Uday

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Search two Strings

You could use a pivottable.

Add headers if you don't have them already.

I'm assuming your data is in A1:B500
And you have dates in B2:B500--no text, no empty cells

Select that range
Data|pivottable
Follow the wizard until you get to a dialog with a Layout button on it.
Click that layout button
drag the header for the name to the Row field
drag the header for the date to the column field
drag the header for the name to the data field.

Since your data is text, you should see Count of Name (which is what you want).

Now finish up the wizard
rightclick on the date header.
Select Group and show detail
Then select group
and select years (and unselect anything else--including months)

And finish up.

You could even group by months and years to see what that shows.

======
And if you really need a macro, record one when you do it manually.




wrote:

Hi,

Need help in writing a macro that gives me a count of occurances of
one string based on the occurance of another string.

Here is what I want.

I have Employees in column A and their vacation dates in B . I need to
write a macro which reports out the count of employees who have
applied for vacation in 2005, 2006 and 2007.

XYZ 12/1/2005
abc 3/1/2006
def 2/1/2007

My excel contains almost 500 rows and I need to write a macro to get
the count based on the year.

Thanks,
Uday


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Search two Strings

On Mar 13, 6:01 pm, Dave Peterson wrote:
You could use a pivottable.

Add headers if you don't have them already.

I'm assuming your data is in A1:B500
And you have dates in B2:B500--no text, no empty cells

Select that range
Data|pivottable
Follow the wizard until you get to a dialog with a Layout button on it.
Click that layout button
drag the header for the name to the Row field
drag the header for the date to the column field
drag the header for the name to the data field.

Since your data is text, you should see Count of Name (which is what you want).

Now finish up the wizard
rightclick on the date header.
Select Group and show detail
Then select group
and select years (and unselect anything else--including months)

And finish up.

You could even group by months and years to see what that shows.

======
And if you really need a macro, record one when you do it manually.



wrote:

Hi,


Need help in writing a macro that gives me a count of occurances of
one string based on the occurance of another string.


Here is what I want.


I have Employees in column A and their vacation dates in B . I need to
write a macro which reports out the count of employees who have
applied for vacation in 2005, 2006 and 2007.


XYZ 12/1/2005
abc 3/1/2006
def 2/1/2007


My excel contains almost 500 rows and I need to write a macro to get
the count based on the year.


Thanks,
Uday


--

Dave Peterson


Thanks Dave for your suggestion. I need a macro to report these counts
in another worksheet. I have two worksheets one is Summary worksheet
and the other contains the data. Based on the data I have 2nd
worksheet I need to report the counts in Summary worksheet. So I would
need the macro.

Thanks,
Uday

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Search two Strings

Can I clarify before answering ....

Can a person appear more than once in Column a And you only want to count
the person once even if they took a vacation twice in the same period?


wrote in message
ups.com...
Hi,

Need help in writing a macro that gives me a count of occurances of
one string based on the occurance of another string.

Here is what I want.

I have Employees in column A and their vacation dates in B . I need to
write a macro which reports out the count of employees who have
applied for vacation in 2005, 2006 and 2007.

XYZ 12/1/2005
abc 3/1/2006
def 2/1/2007

My excel contains almost 500 rows and I need to write a macro to get
the count based on the year.

Thanks,
Uday



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
search for multiple strings Lea from CA[_2_] Excel Discussion (Misc queries) 4 October 16th 09 10:20 PM
Search multiple strings in each cell Dave Peterson Excel Programming 7 December 18th 06 06:05 PM
Search for strings David494 New Users to Excel 6 August 1st 05 01:05 PM
VBA search and compare strings stuart Excel Programming 1 June 11th 04 01:00 AM
Search through individual data strings bcmiller Excel Programming 1 May 19th 04 05:01 PM


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

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

About Us

"It's about Microsoft Excel"