Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
dancab
 
Posts: n/a
Default HOW to Evaluate a range with IF ?

Hi,

I try to get a formula that search in a range A1:A5 which elements are =
100% and base on that search in B1:B5 which elements are = " P1" and return
the number of elements that meat this condition.

This is the formula that I try to use and it does not work.

=SUM(IF($A1:$A6=C1,IF($B1:$B6=$D1,1,0)))

A B C D

1| 100% P1 100% P1
2| 100% P1 80% P2
3| 80% P3
4| 100% P5
5| 100% P2
6| 30% P1

What I spect is 2.

I am big time stuck and I have presentation this week :(

Thanks for your help
  #2   Report Post  
David Billigmeier
 
Posts: n/a
Default

dancab -
Use SUMPRODUCT()...

This formula copied verbatim should give what you are looking for:

=SUMPRODUCT(--(A1:A6=C1),--(B1:B6=D1))

The formula you are using will work as well but you need to enter it using
Ctrl+Shift+Enter because it is an array formula.
--
Regards,
Dave


"dancab" wrote:

Hi,

I try to get a formula that search in a range A1:A5 which elements are =
100% and base on that search in B1:B5 which elements are = " P1" and return
the number of elements that meat this condition.

This is the formula that I try to use and it does not work.

=SUM(IF($A1:$A6=C1,IF($B1:$B6=$D1,1,0)))

A B C D

1| 100% P1 100% P1
2| 100% P1 80% P2
3| 80% P3
4| 100% P5
5| 100% P2
6| 30% P1

What I spect is 2.

I am big time stuck and I have presentation this week :(

Thanks for your help

  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

That formula should work fine if you array enter it, that is, hit
Ctrl-Shift-Enter after typing it not just Enter.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"dancab" wrote in message
...
Hi,

I try to get a formula that search in a range A1:A5 which elements are =
100% and base on that search in B1:B5 which elements are = " P1" and

return
the number of elements that meat this condition.

This is the formula that I try to use and it does not work.

=SUM(IF($A1:$A6=C1,IF($B1:$B6=$D1,1,0)))

A B C D

1| 100% P1 100% P1
2| 100% P1 80% P2
3| 80% P3
4| 100% P5
5| 100% P2
6| 30% P1

What I spect is 2.

I am big time stuck and I have presentation this week :(

Thanks for your help



  #4   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

dancab,

David's SUMPRODUCT is just the thing if you need only one or two results,
like for P1 and P2. If you'll need counts for all possible column-B
entities, a pivot table, set to count, will give them to you. You won't
have to make a formula for every possible column-B value, useful especially
when you don't know in advance what values might be there in a given
circumstance.
--
Earl Kiosterud
www.smokeylake.com

"dancab" wrote in message
...
Hi,

I try to get a formula that search in a range A1:A5 which elements are =
100% and base on that search in B1:B5 which elements are = " P1" and
return
the number of elements that meat this condition.

This is the formula that I try to use and it does not work.

=SUM(IF($A1:$A6=C1,IF($B1:$B6=$D1,1,0)))

A B C D

1| 100% P1 100% P1
2| 100% P1 80% P2
3| 80% P3
4| 100% P5
5| 100% P2
6| 30% P1

What I spect is 2.

I am big time stuck and I have presentation this week :(

Thanks for your help



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
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM
How do I edit a Named Range using macro's behmer Excel Worksheet Functions 2 July 26th 05 09:02 PM
Cannot Expand Named Range - when size of the Range exceeds Snig Excel Discussion (Misc queries) 1 July 7th 05 01:46 PM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 0 April 7th 05 12:47 AM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM


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

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"