PC Review


Reply
Thread Tools Rate Thread

Counting instances in string

 
 
John in Wembley
Guest
Posts: n/a
 
      18th Sep 2007

Hi team

I have a list of dates patients attended a group stored as rows.

Patient Name Session 1 Session2 Session3 Ses 4
John H 28 Sep 29 Sep 30 Sep 01 Oct

the business office wants a report of how many times they attended -
say in Sep.
is there some function to do this?
I just was a field at the start of the row counting the occourances of
(say) Sep.

Ive tinkerd but with no luck

cheers
John
 
Reply With Quote
 
 
 
 
Dave O
Guest
Posts: n/a
 
      18th Sep 2007
Hi, John-
Are the dates stored as Excel-compatible dates, or as text strings?

Dave O

 
Reply With Quote
 
John in Wembley
Guest
Posts: n/a
 
      18th Sep 2007
On Tue, 18 Sep 2007 09:35:24 -0700, Dave O <(E-Mail Removed)> wrote:

>Hi, John-
>Are the dates stored as Excel-compatible dates, or as text strings?


They are stored as dates which I guess is the challanges....
Do I need to go back and input these dates as text?

thanks john


 
Reply With Quote
 
John in Wembley
Guest
Posts: n/a
 
      18th Sep 2007
Is sumproduct the way to go?

 
Reply With Quote
 
Dave O
Guest
Posts: n/a
 
      18th Sep 2007
No, it works better as dates. I mocked up a grid based on your
example, with the headers "Patient Name, Session 1, Session 2, Session
3, Session 4" in cells A1:E1 and the names "Vera, Chuck, Dave" in
cells A2:A4. Cells B2:E4 have Excel compatible dates. Then I created a
summary grid with the headers "Patient Name" and "Sep-07" in A6:B6. B6
is entered as a Excel compatible date and formatted to display as
Sep-07. Patient Names, Vera Chuck and Dave, are entered in A7:A9.

In B7 I have the formula
=SUM(IF(A7=$A$2:$A$4,IF(MONTH($B$2:$E$4)=9,1,0)))

You can copy and paste the formula from this message into your
spreadsheet, but to get a proper return you must press
CTRL-Shift-Enter. This formula is an array function; the curly
brackets around the formula only appear when you simultaneously press
the CTRL-Shift-Enter.

Dave O

 
Reply With Quote
 
PCLIVE
Guest
Posts: n/a
 
      18th Sep 2007
If it i

--

"John in Wembley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi team
>
> I have a list of dates patients attended a group stored as rows.
>
> Patient Name Session 1 Session2 Session3 Ses 4
> John H 28 Sep 29 Sep 30 Sep 01 Oct
>
> the business office wants a report of how many times they attended -
> say in Sep.
> is there some function to do this?
> I just was a field at the start of the row counting the occourances of
> (say) Sep.
>
> Ive tinkerd but with no luck
>
> cheers
> John



 
Reply With Quote
 
PCLIVE
Guest
Posts: n/a
 
      18th Sep 2007
If it is only based on 4 sessions, then maybe:

=SUMPRODUCT(--(A1:A20=J1),--(MONTH(B1:B20)=K1)+(MONTH(C1:C20)=K1)+(MONTH(D120)=K1))

J1 contains the Name you want to search.
K1 contains the month "Number". (September = 9)

Change references as needed.

HTH,
Paul


--

"John in Wembley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi team
>
> I have a list of dates patients attended a group stored as rows.
>
> Patient Name Session 1 Session2 Session3 Ses 4
> John H 28 Sep 29 Sep 30 Sep 01 Oct
>
> the business office wants a report of how many times they attended -
> say in Sep.
> is there some function to do this?
> I just was a field at the start of the row counting the occourances of
> (say) Sep.
>
> Ive tinkerd but with no luck
>
> cheers
> John



 
Reply With Quote
 
Dave O
Guest
Posts: n/a
 
      18th Sep 2007
Sorry, John- this is a better formula:
=SUM(IF(A7=$A$2:$A$4,IF(MONTH($B$2:$E$4)=MONTH($B$6),1,0)))

This is still an array formula but uses the date in the header cell B6
as an argument. That way you can quickly change the month you want to
count.

Our threads are crossing! I thought about Sumproduct too, but you'd
need to add Sumproduct for Session 1 plus Sumproduct for Session 2
plus Sumproduct for Session 3 plus Sumproduct for Session 4, and I
thought it was a bit much. If the data set is very large you may want
to consider this, though, because array formulas create a lot of
overhead within the file, increasing file size and increasing the
calculation time. In smaller data sets they work well.

Dave O

 
Reply With Quote
 
PCLIVE
Guest
Posts: n/a
 
      18th Sep 2007
Oops. I missed session 4.

=SUMPRODUCT(--(A1:A20=J1),--(MONTH(B1:B20)=K1)+(MONTH(C1:C20)=K1)+(MONTH(D120)=K1)+(MONTH(E1:E20)=K1))

Regards,
Paul

--

"PCLIVE" <pclive(RemoveThis)@cox.net> wrote in message
news:%23sBecTh%(E-Mail Removed)...
> If it is only based on 4 sessions, then maybe:
>
> =SUMPRODUCT(--(A1:A20=J1),--(MONTH(B1:B20)=K1)+(MONTH(C1:C20)=K1)+(MONTH(D120)=K1))
>
> J1 contains the Name you want to search.
> K1 contains the month "Number". (September = 9)
>
> Change references as needed.
>
> HTH,
> Paul
>
>
> --
>
> "John in Wembley" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>> Hi team
>>
>> I have a list of dates patients attended a group stored as rows.
>>
>> Patient Name Session 1 Session2 Session3 Ses 4
>> John H 28 Sep 29 Sep 30 Sep 01 Oct
>>
>> the business office wants a report of how many times they attended -
>> say in Sep.
>> is there some function to do this?
>> I just was a field at the start of the row counting the occourances of
>> (say) Sep.
>>
>> Ive tinkerd but with no luck
>>
>> cheers
>> John

>
>



 
Reply With Quote
 
Dave O
Guest
Posts: n/a
 
      18th Sep 2007
Paul- I'd never seen SUMPRODUCT in the format that groups the columns
inside the double unary. Cool! I need to read up on that.

 
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
counting x instances of a string across columns... ucdcrush@gmail.com Microsoft Excel Worksheet Functions 9 19th Jul 2007 12:57 AM
counting the number of instances of a string within another string Keith R Microsoft Excel Worksheet Functions 3 5th Mar 2007 06:54 PM
counting instances of a character within a string =?Utf-8?B?bWlrZWxlZTEwMQ==?= Microsoft Excel Programming 5 19th Dec 2005 04:40 AM
Counting instances of a string in a memo field Keith Microsoft Access Queries 2 2nd Feb 2005 07:24 AM
counting instances Rob582 Microsoft Excel Worksheet Functions 2 20th Nov 2003 06:06 PM


Features
 

Advertising
 

Newsgroups
 


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