Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jeff
 
Posts: n/a
Default Summing "False" and "True"

I have an equality -

Cell A1 "=B1C1"
The value is true since cell B1=10 and C1=3

This repeats down to row 100. A2, A3, ...A100

I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),

But this equals zero. Why doesn't this add 1 when the value is true. Isn't
the value of cell A1 = 1 since the result is a true statement.


  #2   Report Post  
RagDyeR
 
Posts: n/a
Default

Try this:

=SUMPRODUCT(--(B1:B100C1:C100))

--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

"Jeff" wrote in message
...
I have an equality -

Cell A1 "=B1C1"
The value is true since cell B1=10 and C1=3

This repeats down to row 100. A2, A3, ...A100

I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),

But this equals zero. Why doesn't this add 1 when the value is true. Isn't
the value of cell A1 = 1 since the result is a true statement.



  #3   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Jeff wrote:
I have an equality -

Cell A1 "=B1C1"
The value is true since cell B1=10 and C1=3

This repeats down to row 100. A2, A3, ...A100

I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),

But this equals zero. Why doesn't this add 1 when the value is true. Isn't
the value of cell A1 = 1 since the result is a true statement.



One approach which works is:

={SUM(IF(D4:D100=TRUE,1,0))}

Note that this is an array formula, so when you've typed it in you have to hit
Shift-Ctrl-Enter.

Bill
  #4   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Jeff wrote:
I have an equality -

Cell A1 "=B1C1"
The value is true since cell B1=10 and C1=3

This repeats down to row 100. A2, A3, ...A100

I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),

But this equals zero. Why doesn't this add 1 when the value is true. Isn't
the value of cell A1 = 1 since the result is a true statement.



One approach which works is:

={SUM(IF(D4:D100=TRUE,1,0))}

Note that this is an array formula, so when you've typed it in you have to hit
Shift-Ctrl-Enter.

A simpler approach is:

=COUNTIF(D1:D100,TRUE)


Bill
  #5   Report Post  
 
Posts: n/a
Default

Jeff wrote:
I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),
But this equals zero.


SUMPRODUCT(1*(A1:A100)) seems to work.



  #6   Report Post  
RagDyer
 
Posts: n/a
Default

You could simply use:

=SUMPRODUCT(--(A1:A100))

But this still necessitates using ColumnA as a sort of "helper" column, when
it's really superfluous.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

wrote in message
oups.com...
Jeff wrote:
I want to sum up the number of True statements. I use
Sumproduct((A1:A100=1)*1),
But this equals zero.


SUMPRODUCT(1*(A1:A100)) seems to work.


  #7   Report Post  
 
Posts: n/a
Default

wrote:
Jeff wrote:
I want to sum up the number of True statements.
I use Sumproduct((A1:A100=1)*1),


SUMPRODUCT(1*(A1:A100)) seems to work.


RagDyer wrote:
You could simply use:
=SUMPRODUCT(--(A1:A100))

But this still necessitates using ColumnA as a
sort of "helper" column, when it's really superfluous.


And perhaps the OP is interested in that. But since the
OP already indicated an interest in having "helper" cells
in column A, I thought it was prudent to keep them in the
solution.

(Perhaps they serve some other purpose in the OP's application.)

As for "1*" v. "--", first, I think "1*" is more intuitive
than the double-negative. More to the point, it is what
the OP tried to do in the first place; ergo, it is probably
more intuitive to the OP as well. I thought it was
instructive to show the OP how to correct his mistake rather
than "throw the baby out with the bath water" unnecessarily.

To each his own. I was purposely trying to demonstrate a
different approach than those already presented.

  #8   Report Post  
Ragdyer
 
Posts: n/a
Default

You're absolutely correct in your contention of following an OP's lead as
being a good route for suggesting solutions.

It's my contention that perhaps he didn't realize that it could be done in a
more concise manner.

And BTW,
I personally *hate* the unary.
But in some *rare* instances, it just "looks" neater, as in single argument
situations.<g
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


wrote in message
ups.com...
wrote:
Jeff wrote:
I want to sum up the number of True statements.
I use Sumproduct((A1:A100=1)*1),


SUMPRODUCT(1*(A1:A100)) seems to work.


RagDyer wrote:
You could simply use:
=SUMPRODUCT(--(A1:A100))

But this still necessitates using ColumnA as a
sort of "helper" column, when it's really superfluous.


And perhaps the OP is interested in that. But since the
OP already indicated an interest in having "helper" cells
in column A, I thought it was prudent to keep them in the
solution.

(Perhaps they serve some other purpose in the OP's application.)

As for "1*" v. "--", first, I think "1*" is more intuitive
than the double-negative. More to the point, it is what
the OP tried to do in the first place; ergo, it is probably
more intuitive to the OP as well. I thought it was
instructive to show the OP how to correct his mistake rather
than "throw the baby out with the bath water" unnecessarily.

To each his own. I was purposely trying to demonstrate a
different approach than those already presented.


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
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM
Help: runtime error - Method seriescollection object_chart failed huangx06 Charts and Charting in Excel 3 July 9th 05 12:27 AM
if logical test true, then hlookup, if false then difference betwe VictoriaG Excel Worksheet Functions 0 June 7th 05 08:53 PM
Adding True False Results Arla M Excel Worksheet Functions 6 January 27th 05 06:29 PM
Grand Totals @ Same Place Amber M Excel Worksheet Functions 2 December 30th 04 07:13 PM


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