From: T. Valko on
Good deal. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Seb" <Seb(a)discussions.microsoft.com> wrote in message
news:ABC23115-DE8E-49D8-ACCD-57E152F61A0C(a)microsoft.com...
> Thank you so much. I did have one #N/A in the range.
>
> "T. Valko" wrote:
>
>> The only thing that's different in those formulas other than the criteria
>> cells is the range AI2:AI7176.
>>
>> Are there any #N/A errors already in that range? If so, can you fix the
>> formulas so they don't return those errors? If you can't or don't want to
>> fix those, what type of data is in that range, text, numbers, both?
>>
>> --
>> Biff
>> Microsoft Excel MVP
>>
>>
>> "Seb" <Seb(a)discussions.microsoft.com> wrote in message
>> news:4A874A78-8996-4A39-8FDF-F85A51F99A3E(a)microsoft.com...
>> > This is the formula that returns #N/A:
>> > =SUM(IF(('New Code'!$AG$2:$AG$7176=Input!$B$31)*('New
>> > Code'!$AI$2:$AI$7176=B10),'New Code'!$AM$2:$AM$7176)) and I enter it as
>> > an
>> > array formula
>> >
>> > This one, for example, works:
>> > =SUM(IF(('New Code'!$AG$2:$AG$7176=Input!$B$31)*('New
>> > Code'!$AF$2:$AF$7176=F7),'New Code'!$AM$2:$AM$7176)) also entered as an
>> > array
>> > formula
>> >
>> > Seb
>> >
>> >
>> >
>> > "T. Valko" wrote:
>> >
>> >> >when the columns contain formulas I get #N/A.
>> >>
>> >> Post the *exact* formula you are trying to use that returns #N/A.
>> >>
>> >> --
>> >> Biff
>> >> Microsoft Excel MVP
>> >>
>> >>
>> >> "Seb" <Seb(a)discussions.microsoft.com> wrote in message
>> >> news:4A761E9C-FDD1-4F6D-B8D4-7A984693811B(a)microsoft.com...
>> >> > Hi,
>> >> >
>> >> > This formula works great whenever there are values in the columns,
>> >> > but
>> >> > when
>> >> > the columns contain formulas I get #N/A. Do you know how to go about
>> >> > this?
>> >> >
>> >> > Seb
>> >> >
>> >> > "RagDyer" wrote:
>> >> >
>> >> >> You're welcome, and thank you for the feed-back.
>> >> >> --
>> >> >> Regards,
>> >> >>
>> >> >> RD
>> >> >>
>> >> >> ---------------------------------------------------------------------------
>> >> >> Please keep all correspondence within the NewsGroup, so all may
>> >> >> benefit !
>> >> >> ---------------------------------------------------------------------------
>> >> >> "Minx" <Minx(a)discussions.microsoft.com> wrote in message
>> >> >> news:5AB9D85E-BF38-453B-9673-25376BD00B6F(a)microsoft.com...
>> >> >> > That was it!
>> >> >> > (Actually, everything in Row 1 is a text header)
>> >> >> > Thank you so much!!
>> >> >> >
>> >> >> >
>> >> >> > "RagDyeR" wrote:
>> >> >> >
>> >> >> >> You probably have values in B1 to B425 that are *not* true XL
>> >> >> >> recognized
>> >> >> >> numbers!
>> >> >> >>
>> >> >> >> Could B1 be a text header?
>> >> >> >
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


From: travcoe21 on
Hi, Biff --

I just stumbled across this thread, and made use of the formulation for
conditional summing with complex criteria. Thanks a bunch!

Question for you: the formula looks like, and behaves like, there is an
implied conversion from Boolean values of TRUE/FALSE to numerical values of
1/0 going on. That is, if all conditions are true, multiply the sum column
value by 1. If not all of the conditions are true, multiply the sum column
value by 0. IOW, a logical AND of multiple conditions. Is that a good
description? I tried what I thought was the equivalent:

{SUM(AND(cond1, cond2)*sumcolumnvalue)}

.. . . but that didn't work, I assume because of the logic of the array
formula syntax -- correct?

I also discovered a further subtlety of this formulation. What I actually
needed to do logically was:

{SUM(OR(AND(cond1, cond2),AND(cond1, cond3))*sumcolumnvalue)}

The syntax that gave the correct result was to add two separate conditional
summations together, i.e.:

{SUM(cond1*cond2*sumcolumnvalue)+SUM(cond1*cond3*sumcolumnvalue)}

Note that in order for this to work the way it's supposed to, cond1 and
cond3 must never both be true for the same sumcolumnvalue. Which for my
application is always the case.

Anywho, just wanted to share this discovery and help out anyone else who is
trying to do something similar.

"T. Valko" wrote:

> The only thing that's different in those formulas other than the criteria
> cells is the range AI2:AI7176.
>
> Are there any #N/A errors already in that range? If so, can you fix the
> formulas so they don't return those errors? If you can't or don't want to
> fix those, what type of data is in that range, text, numbers, both?
>
> --
> Biff
> Microsoft Excel MVP
>
>
> "Seb" <Seb(a)discussions.microsoft.com> wrote in message
> news:4A874A78-8996-4A39-8FDF-F85A51F99A3E(a)microsoft.com...
> > This is the formula that returns #N/A:
> > =SUM(IF(('New Code'!$AG$2:$AG$7176=Input!$B$31)*('New
> > Code'!$AI$2:$AI$7176=B10),'New Code'!$AM$2:$AM$7176)) and I enter it as an
> > array formula
> >
> > This one, for example, works:
> > =SUM(IF(('New Code'!$AG$2:$AG$7176=Input!$B$31)*('New
> > Code'!$AF$2:$AF$7176=F7),'New Code'!$AM$2:$AM$7176)) also entered as an
> > array
> > formula
> >
> > Seb
> >
> >
> >
> > "T. Valko" wrote:
> >
> >> >when the columns contain formulas I get #N/A.
> >>
> >> Post the *exact* formula you are trying to use that returns #N/A.
> >>
> >> --
> >> Biff
> >> Microsoft Excel MVP
> >>
> >>
> >> "Seb" <Seb(a)discussions.microsoft.com> wrote in message
> >> news:4A761E9C-FDD1-4F6D-B8D4-7A984693811B(a)microsoft.com...
> >> > Hi,
> >> >
> >> > This formula works great whenever there are values in the columns, but
> >> > when
> >> > the columns contain formulas I get #N/A. Do you know how to go about
> >> > this?
> >> >
> >> > Seb
> >> >
> >> > "RagDyer" wrote:
> >> >
> >> >> You're welcome, and thank you for the feed-back.
> >> >> --
> >> >> Regards,
> >> >>
> >> >> RD
> >> >>
> >> >> ---------------------------------------------------------------------------
> >> >> Please keep all correspondence within the NewsGroup, so all may
> >> >> benefit !
> >> >> ---------------------------------------------------------------------------
> >> >> "Minx" <Minx(a)discussions.microsoft.com> wrote in message
> >> >> news:5AB9D85E-BF38-453B-9673-25376BD00B6F(a)microsoft.com...
> >> >> > That was it!
> >> >> > (Actually, everything in Row 1 is a text header)
> >> >> > Thank you so much!!
> >> >> >
> >> >> >
> >> >> > "RagDyeR" wrote:
> >> >> >
> >> >> >> You probably have values in B1 to B425 that are *not* true XL
> >> >> >> recognized
> >> >> >> numbers!
> >> >> >>
> >> >> >> Could B1 be a text header?
> >> >> >
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
From: travcoe21 on
Sorry, I meant cond2 and cond3 are never both true for the same sumcolumnvalue.

Jeff

"travcoe21" wrote:
> Note that in order for this to work the way it's supposed to, cond1 and
> cond3 must never both be true for the same sumcolumnvalue. Which for my
> application is always the case.
From: T. Valko on
>Is that a good description?

Yes

>{SUM(AND(cond1, cond2)*sumcolumnvalue)}

AND returns a single result where you need an array of results.

It sounds like you want an OR comparison: sum C if A = x *or* D = y.

Try one of these:

=SUMPRODUCT(--((A1:A10="x")+(D1:D10="y")>0),C1:C10)

=SUMPRODUCT(SIGN((A1:A10="x")+(D1:D10="y")),C1:C10)

--
Biff
Microsoft Excel MVP


"travcoe21" <travcoe21(a)discussions.microsoft.com> wrote in message
news:11A68799-026D-49AF-A5A3-315D770EAD56(a)microsoft.com...
> Sorry, I meant cond2 and cond3 are never both true for the same
> sumcolumnvalue.
>
> Jeff
>
> "travcoe21" wrote:
>> Note that in order for this to work the way it's supposed to, cond1 and
>> cond3 must never both be true for the same sumcolumnvalue. Which for my
>> application is always the case.