shell_l_d
06-30-2010, 07:08 PM
I'm creating formula's for some rows in an excel table (eg: Table1)
& in the formula, I need to be able to reference the previous row & next row but cant figure out the syntax. There's a [#This Row] special item specifier but there's nothing like [#Previous Row] or [#Next Row].
Eg: a formula in Column5 may need to access the current row in Column1 AND the previous row in Column1...
Current row:
=Table1[[#This Row],[Column1]]
Previous & next row: wrong syntax - FAILS
=Table1[[#This Row] - 1,[Column1]]
=Table1[[#This Row],[Column1] - 1]
=Table1[[#This Row] + 1,[Column1]]
=Table1[[#This Row],[Column1] + 1]
If I manually type in the formula in say D2 & use formula of =A2-A1, it shows this, but I need to write it dynamically in VB, such that if the columns are moved later it will still work, dont want hardcoded value of say A1:
D2 formula, BUT with hard code:
=A2 - A1 - A3 ' dont want this
=Table1[[#This Row],[Column1]] - A1 - A3
Any ideas please?
& in the formula, I need to be able to reference the previous row & next row but cant figure out the syntax. There's a [#This Row] special item specifier but there's nothing like [#Previous Row] or [#Next Row].
Eg: a formula in Column5 may need to access the current row in Column1 AND the previous row in Column1...
Current row:
=Table1[[#This Row],[Column1]]
Previous & next row: wrong syntax - FAILS
=Table1[[#This Row] - 1,[Column1]]
=Table1[[#This Row],[Column1] - 1]
=Table1[[#This Row] + 1,[Column1]]
=Table1[[#This Row],[Column1] + 1]
If I manually type in the formula in say D2 & use formula of =A2-A1, it shows this, but I need to write it dynamically in VB, such that if the columns are moved later it will still work, dont want hardcoded value of say A1:
D2 formula, BUT with hard code:
=A2 - A1 - A3 ' dont want this
=Table1[[#This Row],[Column1]] - A1 - A3
Any ideas please?