Yes. But....
I do not believe that formula does what your English description
says. And I believe your English description is correct. (Well,
almost. We'll get to that later.)
This is when it is best to start with a concrete example of data,
specifying the desired result.
Consider the following in A18:A33 and B18:B33, where "...." separates
columns and "--" indicates a blank cell. Note that I choose the
number of each case (in parentheses) so that we can tell which cases
SUMPRODUCT counts.
-----.....-- (1)
-----.... 0 (2)
-----.... 0
me.....-- (4)
me.....--
me.....--
me.....--
me.... 0 (8)
me.... 0
me.... 0
me.... 0
me.... 0
me.... 0
The following formula is equivalent to yours:
=SUMPRODUCT((A18:A33<>"me")*(B18:B33<>0))
Note that it returns 1, counting only the case of "----.....--" when
there is "me" and there is no 0.
I suspect you want to count at least 2 for the cases of "----.....0",
when there is 0 but no "me". That formula would be:
=SUMPRODUCT((A18:A33<>"me")*(B18:B33=0))
Alternatively, do you want to count 6 for the cases of "me....--" as
well as "----....0"; that is, when there is "me" but no 0 as well as
when there is 0 but no "me"?
That formula would be:
=SUMPRODUCT((A18:A33<>"me")*(B18:B33=0)
+(A18:A33="me")*(B18:B33<>0))
Now consider the case where we have 3 columns where we might find
"me" (B1
16) along with 1 column where we might find 0 (E1:E16. The
left-most column (A1:A16) indicates the row number in order to
facility discussion here.
01....-----....-----....-----....--
02....-----....-----....-----....0
03....-----....-----....me....--
04....-----....-----....me....0
05....-----....me....-----....--
06....-----....me....-----....0
07....-----....me....me....--
08....-----....me....me....0
09....me....-----....-----....--
10....me....-----....-----....0
11....me....-----....me....--
12....me....-----....me....0
13....me....me....-----....--
14....me....me....-----....0
15....me....me....me....--
16....me....me....me....0
Question.... You wrote: " If column J is 0 and me doesn't exist in
one of columns AB to AF, return the word warning". Do you mean: if J
is 0: (a) there must be exactly one "me" in the corresponding row of
AB:AF; or (b) there must be at least one "me" (i.e. one or more "me")
in the corresponding row of AB:AF?
Condition #b is easier (for me) to write than #a. But the best I can
offer is (omitting the worksheet name for brevity; you can add it in):
=SUMPRODUCT((AB7:AB195<>"me")*(AC7:AC195<>"me")
*(AD7:AD195<>"me")*(AE7:AE195<>"me")*(AF7:AF195<>"me")*(J7:J195=0))
Read: count the number of rows when there is no "me" AB __and__ there
is no "me" in AC etc __and__ there is 0 in column J.
Substituting B1:B16<>"me", C1:C16<>"me", D1
16<>"me" and E1:E16=0,
that returns 1 for my example data above. And we can determine that
it is counting only row 2 by temporarily entering "me" in any of the
columns therein.
This is when it would behoove you to heed my previous suggestion, to
wit....
For broader participation, you might want to post future inquiries
using the MS Answers Forums athttp://social.answers.microsoft.com/Forums/en-US/category/officeexcel.
It's not that I like that forum. It's just that MS has ceased to
support the Usenet newsgroups. Hence, participation here is limited
to the sites that share a common newsgroup mirror, which is no longer
centralized at MS.
Clever contributors there might have a much easier formula -- at least
easier to maintain as your needs change over time, even it might be
more difficult to enter and comprehend initially.
If/when you do post to the Answers Forum group, I suggest that you
include the example data that I provided, together with an answer to
my question regarding #a or #b above.