Hi All,
I stumped myself with this one.
I have a sheet with columns numbered 1 through 52 (representing weeks of the year). The column headers can change based on another selection to keep it a fiscal year (start with 1, end with 52), OR they can be updated to show the current week in the first column and roll over after week 52. There is always a total of 52 columns as shown in is example:
Column Headers Example 1:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]..[/TD]
[TD]..[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Column Headers Example 2
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]49[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]47[/TD]
[TD]48[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I also have 2 columns ahead of these weeks indicating a start week and an end week, which will be used to populate data between and including those 2 weeks. A formula is under each of the week column headers (there are multiple rows, but for simplicity I displayed 1 row of data.)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]10[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[/TR]
</tbody>[/TABLE]
Can you help make a formula which determines when to populate data between the start and end week, taking into account that weeks can roll over (or wrap around a year). There are several scenarios I can think of which makes 1 formula a challenge.
Scenario 1 - Week columns start at 1 and data is between a lower and higher week, and weeks requiring data do not roll over the year.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]data should populate here[/TD]
[TD]data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Scenario 2 - Week columns start at 1, but data rolls over the year, with start week lower than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]2[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[/TR]
</tbody>[/TABLE]
Scenario 3 - Columns do not start at 1, and data rolls over the year, with start week lower than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]10[/TD]
[TD]11[/TD]
[TD]12[/TD]
[TD]13[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]10[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[/TR]
</tbody>[/TABLE]
Scenario 4 - Columns do not start at one, and start week higher than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]49[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]47[/TD]
[TD]48[/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Here is an example of what I did, but it fails when the weeks requiring data wrap around the year because its basing it on column location.
Weeks of the year are in in AM6:CL6.
Start week is in AK7
End Week is in AL7
=IF(OR(MATCH(AM$6,$AM$6:$CL$6,0<match($ak7,$am$6:$cl$6,0),match(am$6,$am$6:$cl$6,0)>MATCH($AL7,$AM$6:$CL$6,0)),"","Calculation formula here")
thanks in advance!
Robin</match($ak7,$am$6:$cl$6,0),match(am$6,$am$6:$cl$6,0)>
I stumped myself with this one.
I have a sheet with columns numbered 1 through 52 (representing weeks of the year). The column headers can change based on another selection to keep it a fiscal year (start with 1, end with 52), OR they can be updated to show the current week in the first column and roll over after week 52. There is always a total of 52 columns as shown in is example:
Column Headers Example 1:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]..[/TD]
[TD]..[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Column Headers Example 2
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]49[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]47[/TD]
[TD]48[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I also have 2 columns ahead of these weeks indicating a start week and an end week, which will be used to populate data between and including those 2 weeks. A formula is under each of the week column headers (there are multiple rows, but for simplicity I displayed 1 row of data.)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]10[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[TD]Formula here[/TD]
[/TR]
</tbody>[/TABLE]
Can you help make a formula which determines when to populate data between the start and end week, taking into account that weeks can roll over (or wrap around a year). There are several scenarios I can think of which makes 1 formula a challenge.
Scenario 1 - Week columns start at 1 and data is between a lower and higher week, and weeks requiring data do not roll over the year.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]data should populate here[/TD]
[TD]data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Scenario 2 - Week columns start at 1, but data rolls over the year, with start week lower than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]2[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[/TR]
</tbody>[/TABLE]
Scenario 3 - Columns do not start at 1, and data rolls over the year, with start week lower than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]10[/TD]
[TD]11[/TD]
[TD]12[/TD]
[TD]13[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]10[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[/TR]
</tbody>[/TABLE]
Scenario 4 - Columns do not start at one, and start week higher than end week.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Week[/TD]
[TD]End Week[/TD]
[TD]49[/TD]
[TD]50[/TD]
[TD]51[/TD]
[TD]52[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]...[/TD]
[TD]47[/TD]
[TD]48[/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD]Data should populate here[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Here is an example of what I did, but it fails when the weeks requiring data wrap around the year because its basing it on column location.
Weeks of the year are in in AM6:CL6.
Start week is in AK7
End Week is in AL7
=IF(OR(MATCH(AM$6,$AM$6:$CL$6,0<match($ak7,$am$6:$cl$6,0),match(am$6,$am$6:$cl$6,0)>MATCH($AL7,$AM$6:$CL$6,0)),"","Calculation formula here")
thanks in advance!
Robin</match($ak7,$am$6:$cl$6,0),match(am$6,$am$6:$cl$6,0)>