PC Review


Reply
Thread Tools Rate Thread

Count the number of times specific text appears in a column

 
 
Nannie
Guest
Posts: n/a
 
      27th Aug 2008
I have a column of dates in various formats (sometimes the year is first,
sometimes not). I would like to determine the number of times a specific
four-digit year occurs withing the column. Can you help me? Thanks!
--
Nannie
 
Reply With Quote
 
 
 
 
Bob Bridges
Guest
Posts: n/a
 
      27th Aug 2008
It's pretty easy if Access knows they're dates. If Access thinks they're
just random strings of numbers, it takes an extra step.

Since you said the dates are in various formats, and I kind of figure your
column has all the same format setting -- not very certainly, but it's the
likely supposition -- let's assume the format setting is text, and Excel
doesn't know that column has dates in it. So first you have to get Excel to
know what dates are represented there. Set up a "helper" column to the right
that uses the DATEVALUE function. If all your text dates are in column C,
let this first helper column (in col M, let's say) has the function
=DATEVALUE(C2) in M2. That means M has not a text value but a real Excel
date value in it corresponding to what's in col C.

Now in col N put =YEAR(M2); thus in col N is the year represented by the
date in col C.

To determine how many of those say 2002, for instance, use the formula
=COUNTIF(N,2002).

I don't use COUNTIF much, so take this with a grain of salt -- look it up,
check it out with other Excel jocks, test it for yourself etc.

--- "Nannie" wrote:
> I have a column of dates in various formats (sometimes the year is first,
> sometimes not). I would like to determine the number of times a specific
> four-digit year occurs withing the column.

 
Reply With Quote
 
Member
Join Date: Aug 2008
Posts: 45
 
      27th Aug 2008
=COUNTIF(A1:A600,"*2008*") will count the number of text entries in A1:A600 that have 2008 as a sub string, but it will miss any dates that are entered as Excel serial dates.

=SUMPRODUCT(--ISNUMBER(FIND("2008",TEXT(A1:A600,"yyyy")))) will catch both the text containing 2008 and the serial date values for the year 2008, but it will miss entrys with 2-didgit years (eg. 23/5/08 as text). However, looking for a sub-string "08" is problimatic. How to distinuguish between a date that is year 2008 from a date that is Month August?
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      27th Aug 2008
Are they text fields or real dates just formatted in different ways?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Nannie" <(E-Mail Removed)> wrote in message
news:9BF4FAA0-15D8-41EB-BC0C-(E-Mail Removed)...
>I have a column of dates in various formats (sometimes the year is first,
> sometimes not). I would like to determine the number of times a specific
> four-digit year occurs withing the column. Can you help me? Thanks!
> --
> Nannie



 
Reply With Quote
 
Nannie
Guest
Posts: n/a
 
      27th Aug 2008
They are formatted as dates but most were entered as =xdate(1860,6,11,"yyyy,
mm dd") although some look like ~1862 or after 1862. They are civil war era
dates and Excel can't handle them. (Seems strange Excel doesn't have the
choice of displaying dates with years first.)

Thanks for any assistance!
--
Nannie


"Bob Phillips" wrote:

> Are they text fields or real dates just formatted in different ways?
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "Nannie" <(E-Mail Removed)> wrote in message
> news:9BF4FAA0-15D8-41EB-BC0C-(E-Mail Removed)...
> >I have a column of dates in various formats (sometimes the year is first,
> > sometimes not). I would like to determine the number of times a specific
> > four-digit year occurs withing the column. Can you help me? Thanks!
> > --
> > Nannie

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      27th Aug 2008
What is xdate? I don't know that function, it must be a UDF.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Nannie" <(E-Mail Removed)> wrote in message
news:83D4607F-41EE-459F-9218-(E-Mail Removed)...
> They are formatted as dates but most were entered as
> =xdate(1860,6,11,"yyyy,
> mm dd") although some look like ~1862 or after 1862. They are civil war
> era
> dates and Excel can't handle them. (Seems strange Excel doesn't have the
> choice of displaying dates with years first.)
>
> Thanks for any assistance!
> --
> Nannie
>
>
> "Bob Phillips" wrote:
>
>> Are they text fields or real dates just formatted in different ways?
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>> "Nannie" <(E-Mail Removed)> wrote in message
>> news:9BF4FAA0-15D8-41EB-BC0C-(E-Mail Removed)...
>> >I have a column of dates in various formats (sometimes the year is
>> >first,
>> > sometimes not). I would like to determine the number of times a
>> > specific
>> > four-digit year occurs withing the column. Can you help me? Thanks!
>> > --
>> > Nannie

>>
>>
>>



 
Reply With Quote
 
David Biddulph
Guest
Posts: n/a
 
      27th Aug 2008
http://www.j-walk.com/ss/excel/files/xdate.htm

And to answer part of the OP's original question, Excel certainly can
display dates with the year first.
But it sounds as if you are trying to use vague text, rather than specific
dates.

And to try to answer more of the original question, for normal Excel dates
YEAR() gives the year (as Bob Bridges referred to in his reply), and the
link above implies that there is an equivalent XDATEYEAR function in John's
addin.

And to answer the implied question in the *subject line* of the OP's
original message, you need to remember that Excel dates are not stored as
text, but as numbers. If you want to manipulate them as text and look for
text strings such as the year part of the date, you can convert from date to
text using the TEXT function.
--
David Biddulph

"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What is xdate? I don't know that function, it must be a UDF.
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "Nannie" <(E-Mail Removed)> wrote in message
> news:83D4607F-41EE-459F-9218-(E-Mail Removed)...
>> They are formatted as dates but most were entered as
>> =xdate(1860,6,11,"yyyy,
>> mm dd") although some look like ~1862 or after 1862. They are civil war
>> era
>> dates and Excel can't handle them. (Seems strange Excel doesn't have the
>> choice of displaying dates with years first.)
>>
>> Thanks for any assistance!
>> --
>> Nannie
>>
>>
>> "Bob Phillips" wrote:
>>
>>> Are they text fields or real dates just formatted in different ways?
>>>
>>> --
>>> HTH
>>>
>>> Bob
>>>
>>> (there's no email, no snail mail, but somewhere should be gmail in my
>>> addy)
>>>
>>> "Nannie" <(E-Mail Removed)> wrote in message
>>> news:9BF4FAA0-15D8-41EB-BC0C-(E-Mail Removed)...
>>> >I have a column of dates in various formats (sometimes the year is
>>> >first,
>>> > sometimes not). I would like to determine the number of times a
>>> > specific
>>> > four-digit year occurs withing the column. Can you help me? Thanks!
>>> > --
>>> > Nannie
>>>
>>>
>>>

>
>



 
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
Count the number of times a specific date appears in a range of ce Louisa Microsoft Excel Worksheet Functions 6 19th May 2009 05:26 PM
Count the number of times a specific date appears in a range of ce Louisa Microsoft Excel Worksheet Functions 0 19th May 2009 11:50 AM
count the number of times a specific word appears in a column =?Utf-8?B?QkFS?= Microsoft Excel Worksheet Functions 1 27th Jun 2006 05:03 PM
count number of times a word appears in a column swino Microsoft Excel Charting 1 15th Nov 2003 12:23 AM
Count the times a number appears in a column Paul R Microsoft Excel Worksheet Functions 4 29th Oct 2003 08:46 PM


Features
 

Advertising
 

Newsgroups
 


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