Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default counting a number of cells with 2 range criteria

I have 3 ranges

1. week number
2. Rep code
3. Product value

how do i count the number of weeks that pertain to a specific rep code i.e
countif rep code is equal to 101 and week number is wk 1

Also how do i sum the product value if the weeks relate to say week 1 and
rep code is equal to 101

1 £450 104
1 £1,000 106
1 £1,000 102
1 £800 106
1 £500 106
2 £2,000 102
2 £2,200 104
2 £1,230 104
2 £1,000 102
2 £1,000 108

I want to link the details in to a weekly tracker for sales reps but the
values might change so I can't use filters

Thanks

Garf




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default counting a number of cells with 2 range criteria

Hi

for the Count
=SUMPRODUCT(--($A:1:$A$100)=1),--($C$1:$C$100=101))
For the Value
=SUMPRODUCT(--($A:1:$A$100)=1),--($C$1:$C$100=101),$B$1:$B$100)

But, why not use a Pivot Table instead?
Insert a header row at row 1 with Week, Value and Rep in A1:C1
Place cursor in A1DataPivot TableFinish
On the PT skeleton that appears on a new sheet,
Drag Rep to the Row area
Drag Week to the Column Area
Drag Value to the Data area as Sum of Value

If you prefer, drag Week to the page area, then use the dropdown to select
just one individual week.

The PT that will have been created will be based upon the range of data on
your sheet. As this data will grow as you add more information each week,
you need to have a dynamic range.
If you have XL2003, Use DataListCreatemy data had Headers, before
carrying out the steps above.

If you have an earlier version of Excel, then InsertNameDefine
Name myData
Refers to =$A$1:INDEX($C$C,COUNTA($A:$A))
Right click on any cell in your PTPT WizardbackSource =myData in place
of the fixed range that will have been created.

After entering new data, right click on the PT reportRefresh

--
Regards
Roger Govier

"Garf" wrote in message
...
I have 3 ranges

1. week number
2. Rep code
3. Product value

how do i count the number of weeks that pertain to a specific rep code i.e
countif rep code is equal to 101 and week number is wk 1

Also how do i sum the product value if the weeks relate to say week 1 and
rep code is equal to 101

1 £450 104
1 £1,000 106
1 £1,000 102
1 £800 106
1 £500 106
2 £2,000 102
2 £2,200 104
2 £1,230 104
2 £1,000 102
2 £1,000 108

I want to link the details in to a weekly tracker for sales reps but the
values might change so I can't use filters

Thanks

Garf




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,104
Default counting a number of cells with 2 range criteria

First your description does not match the sample data: is RepCode in column
B or C?
I will assume C as in the sample data
Q1) Do you want, for example, the answer for Rep 106 to be
either 3 -- that code appears three times
=COUNTIF(C1:C100,106)

or 1 -- all three are for the same week
I will look at this if that is what you need - please let us know

Q2: =SUMPRODUCT(--(A1:A100=1),--(C1:C100=101),B1:B100)
Only in Excel 2007 can you use full column references
=SUMPRODUCT(--(A:A=1),--(C:C=101),B:B)
Alternatively, in Excel 2007 you could use COUNTIFS (note the final S)

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Garf" wrote in message
...
I have 3 ranges

1. week number
2. Rep code
3. Product value

how do i count the number of weeks that pertain to a specific rep code i.e
countif rep code is equal to 101 and week number is wk 1

Also how do i sum the product value if the weeks relate to say week 1 and
rep code is equal to 101

1 £450 104
1 £1,000 106
1 £1,000 102
1 £800 106
1 £500 106
2 £2,000 102
2 £2,200 104
2 £1,230 104
2 £1,000 102
2 £1,000 108

I want to link the details in to a weekly tracker for sales reps but the
values might change so I can't use filters

Thanks

Garf





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default counting a number of cells with 2 range criteria

Thanks Roger that's great, will give it a whirl

"Roger Govier" wrote:

Hi

for the Count
=SUMPRODUCT(--($A:1:$A$100)=1),--($C$1:$C$100=101))
For the Value
=SUMPRODUCT(--($A:1:$A$100)=1),--($C$1:$C$100=101),$B$1:$B$100)

But, why not use a Pivot Table instead?
Insert a header row at row 1 with Week, Value and Rep in A1:C1
Place cursor in A1DataPivot TableFinish
On the PT skeleton that appears on a new sheet,
Drag Rep to the Row area
Drag Week to the Column Area
Drag Value to the Data area as Sum of Value

If you prefer, drag Week to the page area, then use the dropdown to select
just one individual week.

The PT that will have been created will be based upon the range of data on
your sheet. As this data will grow as you add more information each week,
you need to have a dynamic range.
If you have XL2003, Use DataListCreatemy data had Headers, before
carrying out the steps above.

If you have an earlier version of Excel, then InsertNameDefine
Name myData
Refers to =$A$1:INDEX($C$C,COUNTA($A:$A))
Right click on any cell in your PTPT WizardbackSource =myData in place
of the fixed range that will have been created.

After entering new data, right click on the PT reportRefresh

--
Regards
Roger Govier

"Garf" wrote in message
...
I have 3 ranges

1. week number
2. Rep code
3. Product value

how do i count the number of weeks that pertain to a specific rep code i.e
countif rep code is equal to 101 and week number is wk 1

Also how do i sum the product value if the weeks relate to say week 1 and
rep code is equal to 101

1 £450 104
1 £1,000 106
1 £1,000 102
1 £800 106
1 £500 106
2 £2,000 102
2 £2,200 104
2 £1,230 104
2 £1,000 102
2 £1,000 108

I want to link the details in to a weekly tracker for sales reps but the
values might change so I can't use filters

Thanks

Garf





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
Counting cells in a range per multiple criteria . . . Dano Excel Worksheet Functions 9 May 19th 08 05:28 PM
Counting the number of cells meeting conditional formating criteria Jeff Excel Worksheet Functions 4 July 9th 05 01:18 AM
Counting unique text/number cells from a range sudeepd12 Excel Discussion (Misc queries) 3 June 15th 05 07:58 PM
Counting unique text/number cells from a range sudeepd12 Excel Worksheet Functions 2 June 14th 05 11:21 PM
Counting Cells with multiple criteria.One criteria supporting wild Azhar Arain Excel Worksheet Functions 1 January 12th 05 08:33 AM


All times are GMT +1. The time now is 05:22 AM.

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"