Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default how to code variable reference?

i have two columns: week, newweek and an integer variable: weekoffset. this
is how the data looks like given a weekoffset value = 2

week newweek
200401 200403 ' < what is the formula for newweek?
200402 200405
200403 0
200405 0
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to code variable reference?

does 200401 mean the first week of 2004.

is 200401 stored as a string? If it is stored as a number

=A1+3

200401 + 2 = 200403

--
Regards,
Tom Ogilvy

"Amil" wrote in message
...
i have two columns: week, newweek and an integer variable: weekoffset.

this
is how the data looks like given a weekoffset value = 2

week newweek
200401 200403 ' < what is the formula for newweek?
200402 200405
200403 0
200405 0



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default how to code variable reference?

I actually want to set this formula in a macro based on the weekOffset
variable. I think you got me on the right track. The week is stored as a
string. I may have to do a conversion first.

"Tom Ogilvy" wrote:

does 200401 mean the first week of 2004.

yes
is 200401 stored as a string? If it is stored as a number

=A1+3


200401 + 2 = 200403

--
Regards,
Tom Ogilvy

"Amil" wrote in message
...
i have two columns: week, newweek and an integer variable: weekoffset.

this
is how the data looks like given a weekoffset value = 2

week newweek
200401 200403 ' < what is the formula for newweek?
200402 200405
200403 0
200405 0




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default how to code variable reference?

Opps. I forgot, I actually need the reference to the next row based on the
offset, as such:

weekOffset = 4
week newweek
200449 200501
200450 ...
200451 ...
200452 ...
200501 ...


"Tom Ogilvy" wrote:

does 200401 mean the first week of 2004.

is 200401 stored as a string? If it is stored as a number

=A1+3

200401 + 2 = 200403

--
Regards,
Tom Ogilvy

"Amil" wrote in message
...
i have two columns: week, newweek and an integer variable: weekoffset.

this
is how the data looks like given a weekoffset value = 2

week newweek
200401 200403 ' < what is the formula for newweek?
200402 200405
200403 0
200405 0




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default how to code variable reference?

Amil,

Sounds like

=If(right($A3+weekoffset,2) 52, $A3+1000+weekoffset-52, $A3+weekoffset)

--
steveB

Remove "AYN" from email to respond
"Amil" wrote in message
...
Opps. I forgot, I actually need the reference to the next row based on the
offset, as such:

weekOffset = 4
week newweek
200449 200501
200450 ...
200451 ...
200452 ...
200501 ...


"Tom Ogilvy" wrote:

does 200401 mean the first week of 2004.

is 200401 stored as a string? If it is stored as a number

=A1+3

200401 + 2 = 200403

--
Regards,
Tom Ogilvy

"Amil" wrote in message
...
i have two columns: week, newweek and an integer variable: weekoffset.

this
is how the data looks like given a weekoffset value = 2

week newweek
200401 200403 ' < what is the formula for newweek?
200402 200405
200403 0
200405 0








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
can i link a variable cost code with a variable sum I need help!! Excel Discussion (Misc queries) 0 August 1st 08 11:40 AM
How to use variable in reference Ming Excel Worksheet Functions 2 July 27th 05 11:24 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM
Variable reference John[_44_] Excel Programming 1 August 8th 03 04:53 PM
Using a variable as a row reference? mjmorrison Excel Programming 2 July 14th 03 07:51 PM


All times are GMT +1. The time now is 05:27 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"