Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Count & Array Function

I have the following Dataset

Month Region Amount
Jan East 10
Jan East 7
Jan West 5
Feb South 2
Feb South 1

I am trying to write an array function that will count the number of
sales in January in the East Region.

I have sucessfully been able to write the array function to sum East
in January but just found out that the Count function does not accept
arrays.

Any help would be appreciated.

Thanks,
Scott

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Count & Array Function

Try:

=SUMPRODUCT(--(A2:A100="Jan"),--(B2:B100="East"),(C2:C100))

If dates are actual dates e.g 01/01/07 formatted as "mmm", not text then for
January:

=SUMPRODUCT(--MONTH(A2:A100)=1),--(B2:B100="East"),(C2:C100))

Equally, you can replace the constants e.g 1(or "Jan") and "East" with
cells containing these values.

FYI the "--" changes the TRUE/FALSE conditions to 1/0 so we can do the
arithmetic.

HTH


"Scott Halper" wrote:

I have the following Dataset

Month Region Amount
Jan East 10
Jan East 7
Jan West 5
Feb South 2
Feb South 1

I am trying to write an array function that will count the number of
sales in January in the East Region.

I have sucessfully been able to write the array function to sum East
in January but just found out that the Count function does not accept
arrays.

Any help would be appreciated.

Thanks,
Scott


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Count & Array Function

On Mar 23, 1:04 pm, Toppers wrote:
Try:

=SUMPRODUCT(--(A2:A100="Jan"),--(B2:B100="East"),(C2:C100))

If dates are actual dates e.g 01/01/07 formatted as "mmm", not text then for
January:

=SUMPRODUCT(--MONTH(A2:A100)=1),--(B2:B100="East"),(C2:C100))

Equally, you can replace the constants e.g 1(or "Jan") and "East" with
cells containing these values.

FYI the "--" changes the TRUE/FALSE conditions to 1/0 so we can do the
arithmetic.

HTH



"Scott Halper" wrote:
I have the following Dataset


Month Region Amount
Jan East 10
Jan East 7
Jan West 5
Feb South 2
Feb South 1


I am trying to write an array function that will count the number of
sales in January in the East Region.


I have sucessfully been able to write the array function to sum East
in January but just found out that the Count function does not accept
arrays.


Any help would be appreciated.


Thanks,
Scott- Hide quoted text -


- Show quoted text -


Thanks, but when I tried your formula, the result is 17 which is the
sum of the two sales in January and I am looking for the number 2.
Any help on that?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Count & Array Function

remove the (c2:c100) from the formula.

Toppers thought that you wanted the Amount field summed--not the count of sales.

Scott Halper wrote:

On Mar 23, 1:04 pm, Toppers wrote:
Try:

=SUMPRODUCT(--(A2:A100="Jan"),--(B2:B100="East"),(C2:C100))

If dates are actual dates e.g 01/01/07 formatted as "mmm", not text then for
January:

=SUMPRODUCT(--MONTH(A2:A100)=1),--(B2:B100="East"),(C2:C100))

Equally, you can replace the constants e.g 1(or "Jan") and "East" with
cells containing these values.

FYI the "--" changes the TRUE/FALSE conditions to 1/0 so we can do the
arithmetic.

HTH



"Scott Halper" wrote:
I have the following Dataset


Month Region Amount
Jan East 10
Jan East 7
Jan West 5
Feb South 2
Feb South 1


I am trying to write an array function that will count the number of
sales in January in the East Region.


I have sucessfully been able to write the array function to sum East
in January but just found out that the Count function does not accept
arrays.


Any help would be appreciated.


Thanks,
Scott- Hide quoted text -


- Show quoted text -


Thanks, but when I tried your formula, the result is 17 which is the
sum of the two sales in January and I am looking for the number 2.
Any help on that?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Count & Array Function

=SUMPRODUCT(--(A2:A100="Jan"),--(B2:B100="East"))

"Scott Halper" wrote:

On Mar 23, 1:04 pm, Toppers wrote:
Try:

=SUMPRODUCT(--(A2:A100="Jan"),--(B2:B100="East"),(C2:C100))

If dates are actual dates e.g 01/01/07 formatted as "mmm", not text then for
January:

=SUMPRODUCT(--MONTH(A2:A100)=1),--(B2:B100="East"),(C2:C100))

Equally, you can replace the constants e.g 1(or "Jan") and "East" with
cells containing these values.

FYI the "--" changes the TRUE/FALSE conditions to 1/0 so we can do the
arithmetic.

HTH



"Scott Halper" wrote:
I have the following Dataset


Month Region Amount
Jan East 10
Jan East 7
Jan West 5
Feb South 2
Feb South 1


I am trying to write an array function that will count the number of
sales in January in the East Region.


I have sucessfully been able to write the array function to sum East
in January but just found out that the Count function does not accept
arrays.


Any help would be appreciated.


Thanks,
Scott- Hide quoted text -


- Show quoted text -


Thanks, but when I tried your formula, the result is 17 which is the
sum of the two sales in January and I am looking for the number 2.
Any help on that?


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
Inconsistent Array Count results Suzanne Excel Worksheet Functions 5 April 6th 06 05:02 PM
Count If Array Formula carl Excel Worksheet Functions 2 November 21st 05 08:52 PM
Count if array contains cells of a certain value Melissa Excel Worksheet Functions 2 July 29th 05 02:37 AM
How can you use count with an array formula similar to using sum PhilH Excel Worksheet Functions 3 June 27th 05 08:00 AM
Can I count in an array based on a function? HokieLawrence Excel Worksheet Functions 2 February 12th 05 03:05 AM


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