Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default I want to prevent a formula from being affected by insert line

I have a formula which is average A1 to A10
When i insert a line in A1 it modifies the formula
to avegare A2-A12 but I want it NOT to change.

Any suggestions ?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 92
Default I want to prevent a formula from being affected by insert line

=AVERAGE(INDIRECT("A1:A10"))

Regards,
Bernd

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default I want to prevent a formula from being affected by insert line

I have a formula which is average A1 to A10
When i insert a line in A1 it modifies the formula
to avegare A2-A12 but I want it NOT to change.


Use $A$1 to $A$10 instead of just A1 to A10.

Rick
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default I want to prevent a formula from being affected by insert line

That won't work, using INDIRECT is the only way when it comes to inserting
rows/columns


--
Regards,

Peo Sjoblom


"Rick Rothstein (MVP - VB)" wrote in
message ...
I have a formula which is average A1 to A10
When i insert a line in A1 it modifies the formula to avegare A2-A12 but
I want it NOT to change.


Use $A$1 to $A$10 instead of just A1 to A10.

Rick



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default I want to prevent a formula from being affected by insert line

"Peo Sjoblom" wrote...
That won't work, using INDIRECT is the only way when it comes to
inserting rows/columns

....

Don't make overly broad assertions. Try to fubar

=AVERAGE(INDEX($1:$65536,1,1):INDEX($1:$65536,10,1 ))

with row insertion/deletion.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default I want to prevent a formula from being affected by insert line

"Rick Rothstein \(MVP - VB\)" wrote...
I have a formula which is average A1 to A10
When i insert a line in A1 it modifies the formula
to avegare A2-A12 but I want it NOT to change.


Use $A$1 to $A$10 instead of just A1 to A10.


You don't seem to be too familiar with how Excel actually works. You
should try testing before responding. Enter the formula

=AVERAGE($A$1:$A$10)

in cell C1. Then insert two rows between rows 4 and 5. The formula
becomes

=AVERAGE($A$1:$A$12)

Absolute referencing only leaves references unchanged during copy and
paste or fill operations. It does nothing at all to prevent changes
during row/column insert/delete operations.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default I want to prevent a formula from being affected by insert line

Actually I would prefer using then:

=AVERAGE(A$1:OFFSET(A$1;9;0))
this will not be affected by inserting lines.

Kind regards,
Erny

"StiDude" schrieb im Newsbeitrag
...
I have a formula which is average A1 to A10
When i insert a line in A1 it modifies the formula
to avegare A2-A12 but I want it NOT to change.

Any suggestions ?

Thanks



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 92
Default I want to prevent a formula from being affected by insert line

Hi Erny,

What if you insert a row before row 1?

Another suggestion:
function avg1to10() as double
avg1to10 =
application.worksheetfunction.average(range(cells( 1,1),cells(10,1)))
end function

[untested]

Regards,
Bernd

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default I want to prevent a formula from being affected by insert line

Hi Bernd,

If this can happen, I would use:

=AVERAGE(INDIRECT("A$1"):INDIRECT("A$10"))

Kind regards,
Erny

"Bernd" schrieb im Newsbeitrag
ups.com...
Hi Erny,

What if you insert a row before row 1?

Another suggestion:
function avg1to10() as double
avg1to10 =
application.worksheetfunction.average(range(cells( 1,1),cells(10,1)))
end function

[untested]

Regards,
Bernd



  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default I want to prevent a formula from being affected by insert line

"Erny" wrote...
Hi Bernd,

If this can happen, I would use:

=AVERAGE(INDIRECT("A$1"):INDIRECT("A$10"))

....

Really? What benefits would your formula provide that the shorter

=AVERAGE(INDIRECT("A1:A10"))

doesn't?



  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default I want to prevent a formula from being affected by insert line

None probably...:-)

Thanks for the tip, I didn't think one could also use an area with INDIRECT
formula, and of course, using INDIRECT, the $ is not required anymore.
Your formula is shorter (and probably faster), but both would work!

Erny

"Harlan Grove" schrieb im Newsbeitrag
oups.com...
"Erny" wrote...
Hi Bernd,

If this can happen, I would use:

=AVERAGE(INDIRECT("A$1"):INDIRECT("A$10"))

...

Really? What benefits would your formula provide that the shorter

=AVERAGE(INDIRECT("A1:A10"))

doesn't?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a line feed in a formula? TX_KniveS Excel Worksheet Functions 5 October 31st 08 12:55 AM
How do I insert a line in excel and carry the formula forward? pmms Excel Discussion (Misc queries) 4 July 26th 06 05:02 PM
Recurring Excel Formula error - multiple users affected! Rayo K Excel Discussion (Misc queries) 3 April 11th 06 02:22 PM
Insert manual line break in formula 0-0 Wai Wai ^-^ Excel Worksheet Functions 3 December 11th 05 07:10 PM
Insert manual line break in formula 0-0 Wai Wai ^-^ Excel Worksheet Functions 1 September 8th 05 12:03 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"