LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 279
Default OR in SUMPRODUCT formula

I recently read Bob Phillips famous paper on SUMPRUCT in
<http://www.xldynamic.com/source/xld.sumproduct.html

It has a lot to say about AND operations using multiplication.
It has a little to say about OR operations using addition.

I need to use both. I have some difficulty in turning FALSE and TRUE
into numbers 0 and 1 - Yes I know TRUE is usually -1.

I have 'slices' of 3 rows:

Row R S T U V W X Y Z AA AB AC Column
19 0 26 18 0 18 0 33 0 0 0 0 0
34 0 0 33 24 0 0 0 0 0 0 0 0
35 0 15 34 25 0 0 0 0 0 0 0 0

I want to OR rows 34 and 35 and AND the result with row 19.
Rows 34 and 35 are fixed. 19 is copied through.

I currently have
=SUMPRODUCT(--(($R19:$AC19<0)*(($R$34:$AC$34+($R$35:$AC$35))<0 ))
which produces the result 2 as intended.

Can the formula be simplified?

34 and 35 OR'd together should be
R S T U V W X Y Z AA AB AC
34 OR 35 0 1 1 1 0 0 0 0 0 0 0 0

19 is ANDed
19 0 1 1 0 1 0 1 0 0 0 0 0

giving the result
34 OR 35 & 19 0 1 1 0 0 0 0 0 0 0 0 0

That 'row' contains one twice and I get the result 2 as intended.

I previously misanalysed my requirement.
I had multiplied the 3 'rows' to produce A and B and C in
=SUMPRODUCT((($R19:$AC19<0)*(($R$34:$AC$34)<0)*( $R$35:$AC$35)<0)))
That produces the answer 1 where 2 is correct. ;)

P.S. I add another component to tweak that formula:
+IF(ISERROR(SEARCH("CIRCLE",$AD19)),0,N(SEARCH("CI RCLE",$AD19)<0))
$AD19 can case-insensitively hold "Circle" or not - not includes $AD19 =
"" which causes SEARCH to give an error.
That formula excerpt is about twice as complicated as I would like it to
be. Any simplification suggestions?

I will explain my data.
Rows represent London Underground stations. Columns represent lines.
My A and (B or C) calculates the number of lines at A common to B or C.
My tweak is used to force an addition to the sumproduct which takes the
values:
0 The stations are not connected
1 One line connects the stations
2 etc. more than 1 line connects or should be considered to connect the
stations.
--
Walter Briscoe
 
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
Nesting a sumproduct formula within a sumif formula. jerrymcm Excel Discussion (Misc queries) 2 October 3rd 07 03:35 PM
sumproduct formula help dr350x Excel Discussion (Misc queries) 1 June 7th 07 01:14 PM
SUMPRODUCT Formula Help CLM Excel Worksheet Functions 4 January 18th 07 10:38 PM
Help - Looking for a Sumproduct formula [email protected] Excel Worksheet Functions 4 November 1st 06 07:39 AM
Sumproduct Formula Mike Excel Worksheet Functions 11 August 15th 05 02:13 AM


All times are GMT +1. The time now is 11:55 PM.

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"