gardnertoo
Well-known Member
- Joined
- Jul 24, 2007
- Messages
- 938
On a spreadhseet running in Excel 2007, I have the following formula in cell D7, where it works just fine:
It looks at a column of OPEN and CLOSE texts and counts the number of OPEN, straightforward enough. So I took the OFFSET portion of that formula and used it inside the following formula in cell E7, where it throws a #VALUE! Error. I'm looking for the number of times an OPEN in column S, W, AA, etc (every fourth column) resulted in a MISSED in column T, X, AB, etc.
The Evaluate Formula box shows that the results of the two OFFSET formulas are the problem. Even though it correctly resolves the ROW()-ROW($D$6) portion to a result of 1, and even though that same formula worked in the other cell. Inside the SUMPRODUCT formula it is resolving the OFFSET as ……{#VALUE!}=”OPEN”……
Adding to my confusion, if I replace the string ROW()-ROW($D$6) with a hard-coded “1”, the formula works as it should; if I replace it with another formula whose result is one, for example “7-6”, this also works. (Proving that my SUMPRODUCT is correctly built) It isn’t a number-of-parenthesis or too-many-nested-formulas problem either, since SQRT(1) also works, as does the ridiculous SQRT(COS(RADIANS(90))) just to get several layers of depth. It seems that the formula only fails when it includes either the ROW() or COLUMN() functions, even though those functions do resolve correctly. I have a workaround, moving the (ROW()-ROW($D$6))*4) portion to a helper cell and referring to that cell in the formula, but I want to know WHY DID I HAVE TO DO THAT?
Code:
=COUNTIF(OFFSET($S$2112:$S$2211,,(ROW()-ROW($D$6))*4),"OPEN")
Code:
=SUMPRODUCT(--(OFFSET($S$2112:$S$2211,,(ROW()-ROW($D$6))*4)="OPEN"),--(OFFSET($T$2112:$T$2211,,(ROW()-ROW($D$6))*4)="MISSED"))
Adding to my confusion, if I replace the string ROW()-ROW($D$6) with a hard-coded “1”, the formula works as it should; if I replace it with another formula whose result is one, for example “7-6”, this also works. (Proving that my SUMPRODUCT is correctly built) It isn’t a number-of-parenthesis or too-many-nested-formulas problem either, since SQRT(1) also works, as does the ridiculous SQRT(COS(RADIANS(90))) just to get several layers of depth. It seems that the formula only fails when it includes either the ROW() or COLUMN() functions, even though those functions do resolve correctly. I have a workaround, moving the (ROW()-ROW($D$6))*4) portion to a helper cell and referring to that cell in the formula, but I want to know WHY DID I HAVE TO DO THAT?