Excel 2007 racalculation and data table

E

Erich Neuwirth

I noticed a change in behavior in Excel 2007.

I am using Data Table to create a list of values and then have a formula
computing the mean of these values.

When the results of Data Table change, the average is NOT updated.
F9 also is not enough for an update, Ctrl-Alt-F9 is needed to get the
updated. The Calculation Option is set to Automatic.

These means the Data Table is not fully integrated in the dependency
graph deciding which formulas need to be updated.

Is there a way to make Excel behave properly, i.e. automatically
 
R

Roger Govier

Hi Erich

If I create a list in A1:B10, with a to i in A1:A9 and 1 to 9 in B1:B9
and choose Insert>Table the table is created as Table 1
If I then say
=AVERAGE(Table1)
I get the answer 5,
If I changes any value in B1:B9, the cell with Average changes
immediately, without having to use F9.

How is your formula constructed?
 
H

Harlan Grove

Roger Govier said:
If I create a list in A1:B10, with a to i in A1:A9 and 1 to 9 in
B1:B9 and choose Insert>Table the table is created as Table 1
....

Perhaps you mean Table1?

I'd be willing to bet you've misread the OP, and that the OP means
Data Tables in the old XL2003 & prior Data > Table sense, or the new
ribbon command Data > (Data Tools) What If Analysis > Data Table.
(Darn that's so much easier to find in the ribbon! And only 3 mouse
clicks rather than 2!)
 
H

Harlan Grove

Harlan Grove said:
...

Perhaps you mean Table1?

I'd be willing to bet you've misread the OP, and that the OP means
Data Tables in the old XL2003 & prior Data > Table sense, or the new
ribbon command Data > (Data Tools) What If Analysis > Data Table.
(Darn that's so much easier to find in the ribbon! And only 3 mouse
clicks rather than 2!)

Confirmed - it's a bug.

Select A1:A20, type =INT(3*RAND()), press [Ctrl]+[Enter].

Select B1:B20, type =ROW()^2, , press [Ctrl]+[Enter].

Enter 0, 1 and 2 into D2:D4, respectively.

Enter the array formula =MAX(IF(A1:A20=D1,B1:B20)) into E1.

Select D1:E4 and run the wonderful ribbon command Data > (Data Tools)
What If Analysis > Data Table.

Enter the formula =AVERAGE(E2:E4) in cell G1.

Repeatedly press [F9] and see the values in cells E2:E4 change but the
formula in G1 stay the same.

SNAFU a la Microsoft.

For the OP: there may be no way to fix this. You may need to add
SheetCalculate event handlers that run Application.CalculateFull. At
least this adds something more to the To Do list for SP-1.
 
E

Erich Neuwirth

Thats correct, I think Data Table from What-If is not working the way it
should, and if what I noticed is not changeable, it is definitely a
serious bug because it contradicts the recalculation model of spreadsheets.
 
R

Roger Govier

Harlan

You're quite right there should not have been a space - it is Table1.

I see what you mean with your example, and from Eric's subsequent
posting you had interpreted his request correctly.
However, all is not lost. It may not be what any of us would have
expected, but one can get it to work correctly.

Follow your steps through to the third line.
Before entering your array formula, highlight cells D1:E4
Insert tab>Data Table>no headers.
Everything in pushed down one row as excel creates it's own headers of
column1 and column2
Enter your array formula in E2, adjusted for the row increase.
=MAX(IF(A1:A20=D2,B1:B20))
Enter in GI your Average formula, again adjusted by 1 row
=AVERAGE(E3:E5)

Don't bother with Data>(DataTools) What If>Data Table (in fact it will
be greyed out).

Press F9 repeatedly and see all of the values change and the average be
computed correctly.

--
Regards

Roger Govier


Harlan Grove said:
Harlan Grove said:
...

Perhaps you mean Table1?

I'd be willing to bet you've misread the OP, and that the OP means
Data Tables in the old XL2003 & prior Data > Table sense, or the new
ribbon command Data > (Data Tools) What If Analysis > Data Table.
(Darn that's so much easier to find in the ribbon! And only 3 mouse
clicks rather than 2!)

Confirmed - it's a bug.

Select A1:A20, type =INT(3*RAND()), press [Ctrl]+[Enter].

Select B1:B20, type =ROW()^2, , press [Ctrl]+[Enter].

Enter 0, 1 and 2 into D2:D4, respectively.

Enter the array formula =MAX(IF(A1:A20=D1,B1:B20)) into E1.

Select D1:E4 and run the wonderful ribbon command Data > (Data Tools)
What If Analysis > Data Table.

Enter the formula =AVERAGE(E2:E4) in cell G1.

Repeatedly press [F9] and see the values in cells E2:E4 change but the
formula in G1 stay the same.

SNAFU a la Microsoft.

For the OP: there may be no way to fix this. You may need to add
SheetCalculate event handlers that run Application.CalculateFull. At
least this adds something more to the To Do list for SP-1.
 
H

Harlan Grove

Roger Govier said:
I see what you mean with your example, and from Eric's subsequent
posting you had interpreted his request correctly.
However, all is not lost. It may not be what any of us would have
expected, but one can get it to work correctly.

No, bugs in the recalculation functionality appearing in features that
have been part of Excel for decades may not be what any of us would
have expected. Specific bugs are never expected (THAT's WHY WE CALL
THEM *BUGS*), though some bugs should be expected whenever Microsoft
combines thorough revision of software packages.

If one makes fundamental changes in the way this is done. Not
unreasonable in NEW workbooks, but a PITA for EXISTING workbooks
already using pre-XL2007 Data > Table.
Follow your steps through to the third line.
Before entering your array formula, highlight cells D1:E4
Insert tab>Data Table>no headers.

Here's another mistake you seem to make repeatedly. There is NOTHING
in the Insert tab labeled Data Table. There's Table in the Tables
section. I'll suppose that's what you mean. You may need to give some
thought to correcting your terminology since the only Data Table as a
single label in the entire ribbon is the one under the Data tab's Data
Tools section under the What If Analysis drop-down, which in this
instance is what the OP meant and what I immediately understood him to
mean. You might have picked up on the problem more quickly if you
weren't so confused on the precise terminology.
Everything in pushed down one row as excel creates it's own headers
of column1 and column2
Enter your array formula in E2, adjusted for the row increase.
=MAX(IF(A1:A20=D2,B1:B20))
Enter in GI your Average formula, again adjusted by 1 row
=AVERAGE(E3:E5)

Yes, the G1 formula now changes/recalcs whenever minimal recalc is
triggered.
Don't bother with Data>(DataTools) What If>Data Table (in fact it
will be greyed out).

And all you lose is the recalculation granularity provided by the
Automatic Except for Data Tables (oops, I was wrong, there's the other
instance of Data Tables in the same label in the ribbon). This setting
affects ONLY the recalculation of the pseudofunction TABLE(). For
particularly large data tables using particularly awkward formulas
calling volatile functions that should produce different results
infrequently, your suggestion would be a major step in the wrong
direction with regard to recalc performance.

And your suggestion only works with data tables that use only the
column input cell. There's no equivalent using new tables to hack
equivalents of data tables using row input cells with or without
column input cells. With columns A and B as before but everything else
cleared,

Enter {0,1,2} into E1:G1.

Enter the array formula =MAX(IF(A1:A15=D1,B1:B15)) in D2.

Select D1:G2 and run the ribbon command Data > (Data Tools)
What If Analysis > Data Table. Select D1 as the row input cell.

Enter the formula =AVERAGE(E2:G2) in I1.

Repeatedly press [F9] and watch the values in E2:G2 change while I1
remains the same.

This is contrived, and row-input-only data tables could always be
transposed to column only ones, but try row and column input data
tables such as the following.

Enter Month, Region, Sales in A1:C1, respectively.

Select A2:A49, type

=INT((ROW()+2)/4)

and press [Ctrl]+[Enter].

Select B2:B49, type

=LOOKUP(MOD(ROW(),4),{0;1;2;3},{"N";"S";"E";"W"})

and press [Ctrl]+[Enter].

Select C2:C49, type

=INT(100000*RAND())

and press [Ctrl]+[Enter].

Enter Month and Region into E1:F1, respectively.

Select I1:T1, type

=COLUMNS($I1:I1)

and press [Ctrl]+[Enter].

Enter N, S, E, W in H2:H5, respectively.

Enter the formula =DSUM(A1:C49,"Sales",E1:F2) in H1.

Enter the formula =SUM(I2:T5) in G1.

Select H1:T5 and run the Data > (Data Tools) What If Analysis > Data
Table. Select E2 as the row input cell and F2 as the column input
cell.

Repeatedly press [F9] and watch I2:T5 and G1.

Given tables' structured referencing, there's no way to hack this in
with tables. You could use Pivot Tables instead of data tables, but
pivot tables aren't included in recalculation like data tables are
(optionally). Pivot tables have to be refreshed manually or via event
handlers. Data tables are automatically recalculated/refreshed upon
minimal recalc when calculation is set to Automatic or upon full
recalc, [Alt]+[Ctrl]+[F9], when calculation is set otherwise.

Spin this as much as you want, this is a bug and a reduction in
functionality. If you have no clue how this feature may have been used
in previous versions, you may not see any reason to miss it. Others
may have different experiences.
 
R

Roger Govier

Hey Harlan - don't shoot the messenger!!!

I am not here to defend MS, I was merely trying to help someone out with
a problem.
Yes, I have got the terminology wrong I was referring to Table, not Data
Table
Yes, I did misinterpret Erich's original posting.
I can't think of any occasion when I have ever used Data Tables and the
What If scenario, other than to answer a query by someone who couldn't
understand how to set them up.

What I did do, was try out exactly what you posted. Found it did exactly
what you said.
I then played around with it a little, by using XL2007 Insert tab >Table
(not Data Table) and found I could get it to work. I merely posted my
findings.

I don't have time to experiment with this latest suggestion right now,
as I need to get to bed, but I will try it tomorrow.
You are probably quite correct.
Yes, if these features of Data Tables (with which I am not familiar)
have been denigrated, then I am absolutely sure it will be a right PTA
for those people using them from earlier XL versions.

But, as I said at the beginning - don't shoot me, I am only the
messenger.

--
Regards

Roger Govier


Harlan Grove said:
Roger Govier said:
I see what you mean with your example, and from Eric's subsequent
posting you had interpreted his request correctly.
However, all is not lost. It may not be what any of us would have
expected, but one can get it to work correctly.

No, bugs in the recalculation functionality appearing in features that
have been part of Excel for decades may not be what any of us would
have expected. Specific bugs are never expected (THAT's WHY WE CALL
THEM *BUGS*), though some bugs should be expected whenever Microsoft
combines thorough revision of software packages.

If one makes fundamental changes in the way this is done. Not
unreasonable in NEW workbooks, but a PITA for EXISTING workbooks
already using pre-XL2007 Data > Table.
Follow your steps through to the third line.
Before entering your array formula, highlight cells D1:E4
Insert tab>Data Table>no headers.

Here's another mistake you seem to make repeatedly. There is NOTHING
in the Insert tab labeled Data Table. There's Table in the Tables
section. I'll suppose that's what you mean. You may need to give some
thought to correcting your terminology since the only Data Table as a
single label in the entire ribbon is the one under the Data tab's Data
Tools section under the What If Analysis drop-down, which in this
instance is what the OP meant and what I immediately understood him to
mean. You might have picked up on the problem more quickly if you
weren't so confused on the precise terminology.
Everything in pushed down one row as excel creates it's own headers
of column1 and column2
Enter your array formula in E2, adjusted for the row increase.
=MAX(IF(A1:A20=D2,B1:B20))
Enter in GI your Average formula, again adjusted by 1 row
=AVERAGE(E3:E5)

Yes, the G1 formula now changes/recalcs whenever minimal recalc is
triggered.
Don't bother with Data>(DataTools) What If>Data Table (in fact it
will be greyed out).

And all you lose is the recalculation granularity provided by the
Automatic Except for Data Tables (oops, I was wrong, there's the other
instance of Data Tables in the same label in the ribbon). This setting
affects ONLY the recalculation of the pseudofunction TABLE(). For
particularly large data tables using particularly awkward formulas
calling volatile functions that should produce different results
infrequently, your suggestion would be a major step in the wrong
direction with regard to recalc performance.

And your suggestion only works with data tables that use only the
column input cell. There's no equivalent using new tables to hack
equivalents of data tables using row input cells with or without
column input cells. With columns A and B as before but everything else
cleared,

Enter {0,1,2} into E1:G1.

Enter the array formula =MAX(IF(A1:A15=D1,B1:B15)) in D2.

Select D1:G2 and run the ribbon command Data > (Data Tools)
What If Analysis > Data Table. Select D1 as the row input cell.

Enter the formula =AVERAGE(E2:G2) in I1.

Repeatedly press [F9] and watch the values in E2:G2 change while I1
remains the same.

This is contrived, and row-input-only data tables could always be
transposed to column only ones, but try row and column input data
tables such as the following.

Enter Month, Region, Sales in A1:C1, respectively.

Select A2:A49, type

=INT((ROW()+2)/4)

and press [Ctrl]+[Enter].

Select B2:B49, type

=LOOKUP(MOD(ROW(),4),{0;1;2;3},{"N";"S";"E";"W"})

and press [Ctrl]+[Enter].

Select C2:C49, type

=INT(100000*RAND())

and press [Ctrl]+[Enter].

Enter Month and Region into E1:F1, respectively.

Select I1:T1, type

=COLUMNS($I1:I1)

and press [Ctrl]+[Enter].

Enter N, S, E, W in H2:H5, respectively.

Enter the formula =DSUM(A1:C49,"Sales",E1:F2) in H1.

Enter the formula =SUM(I2:T5) in G1.

Select H1:T5 and run the Data > (Data Tools) What If Analysis > Data
Table. Select E2 as the row input cell and F2 as the column input
cell.

Repeatedly press [F9] and watch I2:T5 and G1.

Given tables' structured referencing, there's no way to hack this in
with tables. You could use Pivot Tables instead of data tables, but
pivot tables aren't included in recalculation like data tables are
(optionally). Pivot tables have to be refreshed manually or via event
handlers. Data tables are automatically recalculated/refreshed upon
minimal recalc when calculation is set to Automatic or upon full
recalc, [Alt]+[Ctrl]+[F9], when calculation is set otherwise.

Spin this as much as you want, this is a bug and a reduction in
functionality. If you have no clue how this feature may have been used
in previous versions, you may not see any reason to miss it. Others
may have different experiences.
 
E

Erich Neuwirth

MS is always good for surprises.
It turns out the the recalc logic is ok, the bus is in the display
logic. If you set up a table as I described and then scroll the formula
referencing the Data Table out of the visible windows and back to
visible, it will contain the updated value. the same seem to be true for
cells containing formulas referencing this cell.

This is a bug, only in a different place than I thought originally.

Erich
 
H

Harlan Grove

Erich Neuwirth said:
It turns out the the recalc logic is ok, the bus is in the
display logic. If you set up a table as I described and then
scroll the formula referencing the Data Table out of the
visible windows and back to visible, it will contain the
updated value. the same seem to be true for cells containing
formulas referencing this cell.

This is a bug, only in a different place than I thought
originally.

You can also force display of the correct value using print preview.

And you can force correct display upon recalc by adding 0*RAND() to
the AVERAGE formula since that's enough to force Excel to display the
correct value.

If this affects cells that reference the AVERAGE formula, I don't
think I'd say it's not a recalc bug. That scrolling and print preview
force display of the correct value is very strange. Leads one to
wonder whether other formulas/situations might show the same behavior.
 
Top