Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default sumif and countif?

A B
EG 2006
EG 2007
EH 2007

I have the following example. I want to count EG if B is 2007. This
example would yield 1. I utilized =if(B:B=2007, countif(A:A, "EG)).
This formula yields 2. I basically need a formula that will look at
both criterion. Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default sumif and countif?


Try this

=sumproduct(--(A:A="EG"),--(B:B=2007))

" wrote:

A B
EG 2006
EG 2007
EH 2007

I have the following example. I want to count EG if B is 2007. This
example would yield 1. I utilized =if(B:B=2007, countif(A:A, "EG)).
This formula yields 2. I basically need a formula that will look at
both criterion. Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default sumif and countif?

On Mar 12, 4:41 pm, wrote:
A B
EG 2006
EG 2007
EH 2007

I have the following example. I want to count EG if B is 2007. This
example would yield 1. I utilized =if(B:B=2007, countif(A:A, "EG)).
This formula yields 2. I basically need a formula that will look at
both criterion. Thanks in advance.



This should do it:

Use DCountA

Your data sheet will need column headers.

In a seperate sheet (I create a sheet called "REFERENCE" and hide it)
put your criteria:

A B
1 TYPE DATE
2 EG 2007


Dim ws As Worksheet
Set ws = "yourdatasheet name here"

Dim refSheetRangeString As String
refSheetRangeString = "A1:B2"


Dim count As Variant
Dim countFilteredRows As Long
count = Empty
count = Application.DCountA(ws.UsedRange, countColumnHeader,
referenceSheet.Range(refSheetRangeString))
If (Not IsError(count)) Then
countFilteredRows = count
Else
countFilteredRows = 0
End If

I can send you a general purpose function that can do this on up to 5
columns if you want...

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default sumif and countif?

You cannot use complete columns in SUMPRODUCT, the ranges have to be
defined.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Barb Reinhardt" wrote in message
...

Try this

=sumproduct(--(A:A="EG"),--(B:B=2007))

" wrote:

A B
EG 2006
EG 2007
EH 2007

I have the following example. I want to count EG if B is 2007. This
example would yield 1. I utilized =if(B:B=2007, countif(A:A, "EG)).
This formula yields 2. I basically need a formula that will look at
both criterion. Thanks in advance.




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
Sumif / Countif Blue Excel Worksheet Functions 3 May 15th 09 03:50 PM
Countif & Sumif JulesHR Excel Worksheet Functions 7 May 29th 08 04:20 PM
Sumif/countif reno Excel Discussion (Misc queries) 2 October 1st 07 03:43 PM
COUNTIF?? SUMIF?? Vegs Excel Discussion (Misc queries) 1 December 19th 05 03:52 PM
{} SumIf and CountIf SS Excel Worksheet Functions 5 May 24th 05 09:19 PM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"