PC Review


Reply
Thread Tools Rate Thread

Count values either vba or formula

 
 
casey
Guest
Posts: n/a
 
      3rd Oct 2007
Sample of what I am trying to achieve:

Worksheet1: (column A, B, C, D, E) - source data

id,primary region, secondary region, tertiary region, status
111,americas,new york, NA, increase
111,americas,canada,NA, increase
111,americas,mexico,LATAM,increase
111,americas,peru,LATAM,decrease
112,europe,france,WEST,increase
112,europe,spain,WEST,decrease
112,europe,uk,WEST,decrease
112,europe,portugal,WEST,decrease
etc....

Worksheet2: (contains summary sheet) - summarize data

111,americas,NA, increase, 2 <----- count instances found from worksheet1
111,americas,LATAM,increase, 1
111,americas,LATAM,decrease, 1
112,europe,WEST,increase, 1
112,europe,WEST,increase, 1
112,europe,WEST,decrease, 3




 
Reply With Quote
 
 
 
 
T. Valko
Guest
Posts: n/a
 
      3rd Oct 2007
Try this:

=SUMPRODUCT(--(Sheet1!A$2:A$9=A2),--(Sheet1!B$2:B$9=B2),--(Sheet1!D$2$9=C2),--(Sheet1!E$2:E$9=D2))

Copy down as needed.

--
Biff
Microsoft Excel MVP


"casey" <no_spam@no_spam.com> wrote in message
news:_(E-Mail Removed)...
> Sample of what I am trying to achieve:
>
> Worksheet1: (column A, B, C, D, E) - source data
>
> id,primary region, secondary region, tertiary region, status
> 111,americas,new york, NA, increase
> 111,americas,canada,NA, increase
> 111,americas,mexico,LATAM,increase
> 111,americas,peru,LATAM,decrease
> 112,europe,france,WEST,increase
> 112,europe,spain,WEST,decrease
> 112,europe,uk,WEST,decrease
> 112,europe,portugal,WEST,decrease
> etc....
>
> Worksheet2: (contains summary sheet) - summarize data
>
> 111,americas,NA, increase, 2 <----- count instances found from worksheet1
> 111,americas,LATAM,increase, 1
> 111,americas,LATAM,decrease, 1
> 112,europe,WEST,increase, 1
> 112,europe,WEST,increase, 1
> 112,europe,WEST,decrease, 3
>
>
>
>



 
Reply With Quote
 
adam.vero@gmail.com
Guest
Posts: n/a
 
      3rd Oct 2007
On 3 Oct, 01:40, "casey" <no_spam@no_spam.com> wrote:
> Sample of what I am trying to achieve:
>
> Worksheet1: (column A, B, C, D, E) - source data
>
> id,primary region, secondary region, tertiary region, status
> 111,americas,new york, NA, increase
> 111,americas,canada,NA, increase
> 111,americas,mexico,LATAM,increase
> 111,americas,peru,LATAM,decrease
> 112,europe,france,WEST,increase
> 112,europe,spain,WEST,decrease
> 112,europe,uk,WEST,decrease
> 112,europe,portugal,WEST,decrease
> etc....
>
> Worksheet2: (contains summary sheet) - summarize data
>
> 111,americas,NA, increase, 2 <----- count instances found from worksheet1
> 111,americas,LATAM,increase, 1
> 111,americas,LATAM,decrease, 1
> 112,europe,WEST,increase, 1
> 112,europe,WEST,increase, 1
> 112,europe,WEST,decrease, 3


Sounds like a perfect use for a Pivot Table to me

 
Reply With Quote
 
troy@loxleycorp.com
Guest
Posts: n/a
 
      4th Oct 2007
On Oct 4, 2:56 am, adam.v...@gmail.com wrote:
> On 3 Oct, 01:40, "casey" <no_spam@no_spam.com> wrote:
>
>
>
>
>
> > Sample of what I am trying to achieve:

>
> > Worksheet1: (column A, B, C, D, E) - source data

>
> > id,primary region, secondary region, tertiary region, status
> > 111,americas,new york, NA, increase
> > 111,americas,canada,NA, increase
> > 111,americas,mexico,LATAM,increase
> > 111,americas,peru,LATAM,decrease
> > 112,europe,france,WEST,increase
> > 112,europe,spain,WEST,decrease
> > 112,europe,uk,WEST,decrease
> > 112,europe,portugal,WEST,decrease
> > etc....

>
> > Worksheet2: (contains summary sheet) - summarize data

>
> > 111,americas,NA, increase, 2 <----- count instances found from worksheet1
> > 111,americas,LATAM,increase, 1
> > 111,americas,LATAM,decrease, 1
> > 112,europe,WEST,increase, 1
> > 112,europe,WEST,increase, 1
> > 112,europe,WEST,decrease, 3

>
> Sounds like a perfect use for a Pivot Table to me- Hide quoted text -
>
> - Show quoted text -


Hi Casey,

If you create an identifier/key for each summary group you can then
use =COUNTIF() to count them.

Like this:

Worksheet1:
1. In F1 enter =A1&B1&D1&E1 (don't include the secondary region). This
will indicate which summary group the record belongs to.
2. Copy down.
Worksheet2:
3. In E1 enter =COUNTIF(Sheet1!F:F,A1&B1&C1&D1). This searches Column
F on Worksheet1 for the summary group and counts how many it finds.
You could also add a new column with the summary group identifier in
it and reference this cell in your =COUNTIF instead of creating the
identifier directly in the =COUNTIF (does that make sense ?? lol)
4. Copy down.

My usual approach with these situations is to insert a new column
before A on both sheets and put the identifiers in this column, then
hide it. This way your model looks the same as it always did but you
have the mechanics churning away in the background!

HTH

cheers,
t.

www.eXtreme-eXcel.com
....be indispensable... they'll pay you more!

 
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
Need a formula to count values in different rows ceri_m Microsoft Excel Worksheet Functions 7 10th Apr 2008 11:14 AM
Formula to count unique values in a range Dave K Microsoft Excel Discussion 11 22nd Mar 2008 10:39 AM
RE: Formula to count distinct values not working in VBA =?Utf-8?B?QUxBVEw=?= Microsoft Excel Programming 2 22nd Dec 2006 09:41 PM
Formula to count values in two columns =?Utf-8?B?SkJ1cmxhZ2U=?= Microsoft Excel Misc 6 31st Aug 2006 12:59 PM
count values in formula Bill Microsoft Excel Discussion 3 22nd Apr 2004 11:28 PM


Features
 

Advertising
 

Newsgroups
 


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