Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Multiple criteria using COUNT and IF

Posted on 2011-09-21
Medium Priority
237 Views
Hi
Would you please check my attached excel sample file where I want to count the total of *Approved* in cell B:B of sheet Status where cell A:A match with the criteria(best001)
Result in cell A2 Sheet1 will be 8(those are colered in Green)
I added formulla in cell A2 only but it gave me 0.
It would be great if you update the attached file and send it back to me.

Thanks

testcountif.xls
0
Question by:alam747
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4
• 3

LVL 50

Expert Comment

ID: 36578231
Hello,

in Excel 2007 and later you would be able to use Countifs, in 2003 and earlier you can use Sumproduct.

=SUMPRODUCT(--(NOT(ISERROR(FIND("best001",Status!\$A\$1:\$A\$38)))),--(Status!\$B\$1:\$B\$38="Approved"))

cheers, teylyn
0

LVL 50

Expert Comment

ID: 36578276
The above will find any cell that contains "best001" AND has approved in the next cell. If you want to find an exact match for the text

Alpha"best001"

then you can also use

=SUMPRODUCT(--(Status!\$A\$1:\$A\$38="Alpha"&"""best001"&""""),--(Status!\$B\$1:\$B\$38="Approved"))

The quotation marks in the cell require the unusual formulation of the search string.

cheers, teylyn

0

Author Comment

ID: 36578314
I am using office 2003.Not much familiar of excel formula.

Thanks
0

Author Comment

ID: 36578339
Sorry, I will try the way you advised, and let you know if I face any problem. Please ignore my previous comment.
Thanks
0

Author Comment

ID: 36578393
Thanks a lot, it works only one thing I want to do is instead of specific line numbers(as you write \$A\$1: \$A\$38 same \$B\$1:\$B38) how can I use like A:A and B:B to count as many lines in cell A and cell B have data to count .

Thanks
0

LVL 85

Expert Comment

ID: 36578852
Not for points.

You cannot do that in 2003. You have to specify a range, although you can use \$A\$2:\$A\$65536 for example. Better to use dynamic named ranges though: http://www.contextures.com/xlNames01.html#Dynamic

Regards,
Rory
0

LVL 50

Accepted Solution

Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 2000 total points
ID: 36579051
Hello,

please find in the attached file

- two dynamic range names for the Company and Status columns in the Status sheet
Company      =Status!\$A\$1:INDEX(Status!\$A:\$A,COUNTA(Status!\$A:\$A))
Status      =OFFSET(Company,0,1)

- an adjusted Sumproduct formula that uses these range names rather than fixed references

=SUMPRODUCT(--(NOT(ISERROR(FIND("best001",Company)))),--(Status="Approved"))

cheers, teylyn
testcountif.xls
0

Author Closing Comment

ID: 36694108
Thanks a lot, it helps....
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,â€¦
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
###### Suggested Courses
Course of the Month10 days, 13 hours left to enroll