by JoeU200 » Wed, 08 Jul 2009 08:24:52
It is unclear whether you want to evaluate this on a row-by-row basis, or
whether you want to evaluate the conditions against entire sets of columns.
On a row-by-row basis:
=if(countif(A1:C1,">0")>0,
if(countif(D1:F1,">0")>0,"code1","code2"),
if(countif(D1:F1,">0")>0,"code3","code4"))
Based on entire sets of columns:
=if(countif(A1:C100,">0")>0,
if(countif(D1:F100,">0")>0,"code1","code2"),
if(countif(D1:F100,">0")>0,"code3","code4"))
Some notes:
1. The second formula (entire sets of columns) assumes that either all of
the columns have the same number of rows of data or at least that shorter
columns of data are blank in the remaining rows up to the longest column.
2. The COUNTIF usage does not distinguish between cells with nothing and
cells with zero or negative values (instead of dates). Some combination of
COUNTA and COUNTIF could make that distinction. But it seems unnecessary
since you do not specify any codes to cover it.
3. My "code1", "code2" and "code3" are intended to correspond to the order
of the conditions that you specified, namely:
a. "any of the first 3 and the last are basically greater then 0"
(code1);
b. "any of the first 3 are greater then 0 and there is nothing in any of
the last 3 columns" (code2);
c. "any of the last 3 are greater then 0 and there is nothing in the
first 3 columns" (code3).
4. I added "code4" to cover a condition that you do not specify, namely:
nothing in the first __and__ last set of 3 columns.
If you are confident that the condition cannot arise, you could simply
remove ``,"code4"`` or replace it with ``,"ERROR"``.
----- original message -----