0
votes

In order to do some calculations on averages and differences of values in columns, I've defined a name, based on a range, but it seems to be completely going berserk:

I have a cell (D13), defined as Header_First _Answer, which contains the title of the column, and I have a value (currently being 69), which contains the number of entries, called Total_Count.

I've defined the entries of that column as another name: "All_First_Answered_Dates", defined as =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0) (start by the first entry under Header_First_Answer, take up to 69 entries, and define a range out of this).

In cell G5, I'm using that name in order to do some calculations (calculating averages), but this seems not to work (there is a #Value error).

After second comment from Rory: G5 formula and first formula evaluation result:

Formula:

=AVERAGE(IF(ISBLANK(All_First_Answered_Dates);TODAY();All_First_Answered_Dates) - All_Start_Dates)

First evaluation result:

=AVERAGE(IF(ISBLANK(#Value!);TODAY();All_First_Answered_Dates) - All_Start_Dates)

Hence, my conclusion:

After some checking I've found out that this is due to the name "All_First_Answered_Dates", which seems to be interpreted one time too many (or how do I explain this):

In different cells, I've entered the formula =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0) (which is exactly the meaning of "All_First_Answered_Dates"), and every time, using the Evaluate Formula feature, I see that the last but one result is correct: $D$14:$D$82. However, after that, another evaluation is done, turning this value into 43283 (in case the formula is entered in "J14"), 43300 (in case the formula is entered in "J15"), ..., and in case I enter this formula in a cell with row number lower than 14, I have the error value #Value (which explains the wrong result in cell G5).

If I simply put the formula =$D$14:$D$82 in any of the mentioned cells, then the content of some cells in column D are shown (which are dates, not values like 43283 or 43300).

It appears that declaring a range as =x:y, where x and y are formula results, is not working.

Does anybody know how I can define a range as a formula, which I can then use in order to define in a name?

I can imagine my explanation being quite complicated without an image, hence the attached screenshot. In there:

  • In cell J13, there is the formula =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0).
  • In cell J14, there is the same formula.
  • In cell K14, there is the formula =$D$14:$D$82.

Screenshot

For completion purposes, hereby a screenshot of the name manager, containing both mentioned names (the ones, selected in the name manager):

Name manager screenshot

Edit after first comment:

The idea behind the range is the following:
1. Take the first row under Header_First_Answer, do not take any other column : OFFSET(Header_First_Answer;1;0)
2. Take the Total_Count's row under Header_First_Answer, do not take any other column : OFFSET(Header_First_Answer;Total_Count;0)
3. Define a range, based on those two cells, by putting a semicolon between them.

I was not aware of the height and width features of the Offset() worksheet function. I've implemented them, which makes the formulas much easier.

Unfortunately the problem still persists.

Thanks in advance
Dominique

1
What exactly is the formula that returns #VALUE!? FYI, you don't need that construction anyway as you can use: =OFFSET(Header_First_Answer;1;0;Total_Count;1)Rory
@Rory: thanks for your quick reply. As mentioned in the "edit" of the question, I've implemented your proposal but the problem still exists.Dominique
What do you expect to see as the result of that formula? It doesn't make sense to just enter it into one cell without some sort of function being applied to it.Rory
@Rory: You're right. The formula =Offset(…) has no meaning as such, but in cell G5, there is a formula, using this as an input for calculating averages, this formula is having a problem and the "Evaluate Formula" feature indicates that the "Value!" error already appears on the evaluation of the offset calculation, hence my question. I've added G5 formula and the first result of the formula evaluation to the question.Dominique

1 Answers

0
votes

I've just found the answer of what was going wrong:
The formula was meant to be an array formula. Something went wrong and while trying to debug, I accidently re-formatted the formula into a normal formula (I must have pressed "ENTER" instead of "Ctrl" + "Shift" + "ENTER") at some point.

I have re-applied array formula (using "Ctrl" + "Shift" + "ENTER"), getting a formula like:

{=AVERAGE(IF(ISBLANK(All_First_Answered_Dates);TODAY();All_First_Answered_Dates) - All_Start_Dates)}

(mind the braces {, })

Now everything is working fine.