View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default need help with a formula

Bernard,

While {1, 0, 1}+{1, 1, 0} yields {1, 1, 1} when each element in the first
array is added (binary adding giving either 0 or 1) to the correspond
element in the second array. We get a 1 in any position were EITHER array
has a 1.


??

Whilst I appreciate that in the data for your formula it is not possible to
have any cell in Row 12 equalling both "A" and "B at the same time surely if
it is possible, like with A, B, A in C12:E12 and B, B, A in C13:E13, then
with the formula:

=SUMPRODUCT((C12:E12="A")*1+(C13:E13="B")*1)

(the *1's are of course to force 1's and 0's )

I get {1,0,1} + {1,1,0} like in your example but the resolves to:

{2,1,1} not {1, 1, 1}

Thus I get 4 not 3!

I know that you are right in what you say about binary arithmetic but surely
in this case we have only simple arithmetic?

Or am I missing something
--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


with @tiscali.co.uk


"Bernard Liengme" wrote in message
...
Hello Bill
In the expression (range1)*(range2) the * operator can be thought of as
AND
while (range1)+(range2) the + operator is OR

Think about {1, 0, 1}*{1, 1, 0}; we get {1, 0, 0} when each element in the
first array is multiplied by the correspond element in the second array.
We get 1 in the position were BOTH arrays have a 1.
While {1, 0, 1}+{1, 1, 0} yields {1, 1, 1} when each element in the first
array is added (binary adding giving either 0 or 1) to the correspond
element in the second array. We get a 1 in any position were EITHER array
has a 1.

My last 'lecture' for 2006!!!

hope this helps
all the best
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Bill Kuunders" wrote in message
...
Thanks Bernard
I tried to shorten it, but was using the old fashioned * format. Still
learning over here.........

Bill

"Bernard Liengme" wrote in message
...
Or even something in this form
=SUMPRODUCT((C12:AG12="A")+(C12:AG12="B"), (C13:AG13))
Happy New Year from Nova Scotia
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Bill Kuunders" wrote in message
...
One way

For your first question
use
=SUMPRODUCT((C12:AG12="A")*(C13:AG13))+SUMPRODUCT( (C12:AG12="F")*(C13:AG13))

Happy new year
From New Zealand

"Rhonda Edwards" wrote in
message ...
I need help with a formula. If cells C12 through AG 12 have an "A" or
an "F"
listed in any cell, I want to add and total the actual whole numbers
listed
in cells C13 through AG13 (that have A or F above them in the
column)totaling
them in cell in AH (where I merged the cells 11-13). Then in AI,
totaling
all the numbers in C13 through AG13 that have "T" listed in any cell
from C12
through AG 12. And so on. I have tried to figure this out from
reading the
help menu in Excel but I haven't been able to; can someone help.
Thanks,
--
Rhonda

--
Rhonda