#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default sumproduct

Hi, could somebody explain why the '-' in
=SUMPRODUCT(-(F2:F14="S"),-(G2:G14<8)), make such a difference. Used
without, which I was doing until Iposted here earlier, doesnt return
the same results.
Regards Robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default sumproduct

The result of the comparisons, (F2:F14="S") and (G2:G14<8), are Boolean
values, either TRUE or FALSE. The minus sign tells Excel to use the negative
numeric value (TRUE = 1 and FALSE = 0), so the '-' operator coerces a TRUE
to -1 and FALSE to 0.

This particular formula works because there are two (or any even number) '-'
operators, and a negative times a negative returns a positive result. If a
third (or any odd number) condition, say -(H2:H14<10) were added, the
formula would return a negative result because a negative times a negative
times a negative returns a negative.

Far better is to use the common technique of using '--' which forces each
comparison to negative, then back to positive (the negative of a negative is
a positive).

=SUMPRODUCT(--(F2:F14="S"),--(G2:G14<8))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"RobcPettit" wrote in message
oups.com...
Hi, could somebody explain why the '-' in
=SUMPRODUCT(-(F2:F14="S"),-(G2:G14<8)), make such a difference. Used
without, which I was doing until Iposted here earlier, doesnt return
the same results.
Regards Robert



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
Sumproduct with Condition OR Sumproduct with ADDRESS function - HE gholly Excel Discussion (Misc queries) 2 September 28th 09 05:07 PM
SUMPRODUCT ColleenK Excel Discussion (Misc queries) 3 May 20th 09 03:23 PM
Conditional SUMPRODUCT or SUMPRODUCT with Filters Ted M H Excel Worksheet Functions 4 August 14th 08 07:50 PM
sumproduct? sumif(sumproduct)? David Excel Worksheet Functions 3 July 13th 07 07:06 PM
SumProduct Help Dan Oakes Excel Worksheet Functions 5 January 12th 07 12:00 AM


All times are GMT +1. The time now is 09:20 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"