A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel 2007 Countifs macro with multiple criteria (OR)



 
 
Thread Tools Display Modes
  #1  
Old March 19th, 2010, 09:44 AM posted to microsoft.public.excel.worksheet.functions
Tapani Mikkola
external usenet poster
 
Posts: 1
Default Excel 2007 Countifs macro with multiple criteria (OR)

Been working on this reporting macro for excel 2007. Cant figure out how to
make countifs work for many possible values in one cell.

I have report with multiple colums. With no problem I can check if call has
been on hold for less than 26 seconds etc.

But in the same countifs sentence I should check also if colum H cell has
one of correct names from 50 possible names. There is something like 50 names
and about 30 names should be counted and the other 20 not. So I think I need
somekind of a OR sentence inside criteria (also saw one possible solution
that there would be possible to use array in the criteria)

So I have sentence like this:

x.CountIfs(Range("C:C"), "name here", Range("E:E"), puhlinja)

And should make it something like this:

x.CountIfs(Range("C:C"), {"name here", "next name", "another name"},
Range("E:E"), puhlinja)

And that should work as OR so it would check all those names from there. Any
of names written should give true value.

Hope someone understands what I'm trying to achieve here .
  #2  
Old March 19th, 2010, 11:54 AM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Excel 2007 Countifs macro with multiple criteria (OR)

On Fri, 19 Mar 2010 02:44:02 -0700, Tapani Mikkola Tapani
wrote:

Been working on this reporting macro for excel 2007. Cant figure out how to
make countifs work for many possible values in one cell.

I have report with multiple colums. With no problem I can check if call has
been on hold for less than 26 seconds etc.

But in the same countifs sentence I should check also if colum H cell has
one of correct names from 50 possible names. There is something like 50 names
and about 30 names should be counted and the other 20 not. So I think I need
somekind of a OR sentence inside criteria (also saw one possible solution
that there would be possible to use array in the criteria)

So I have sentence like this:

x.CountIfs(Range("C:C"), "name here", Range("E:E"), puhlinja)

And should make it something like this:

x.CountIfs(Range("C:C"), {"name here", "next name", "another name"},
Range("E:E"), puhlinja)

And that should work as OR so it would check all those names from there. Any
of names written should give true value.

Hope someone understands what I'm trying to achieve here .


One solution might be to ADD separate countifs.

Also, consider using Sumproduct
--ron
  #3  
Old March 19th, 2010, 10:45 PM posted to microsoft.public.excel.worksheet.functions
Herbert Seidenberg
external usenet poster
 
Posts: 1,113
Default Excel 2007 Countifs macro with multiple criteria (OR)

Excel 2007 PivotTable
A no code, no formula approach.
http://c0718892.cdn.cloudfiles.racks...03_19_10b.xlsx
Pdf preview:
http://www.mediafire.com/file/1lm13iymumy/03_19_10b.pdf

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.