excelhelp7
New Member
- Joined
- Sep 1, 2013
- Messages
- 1
Hi,
I would like to code something simple to automate the following process:
[TABLE="width: 337"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD] [/TD]
[TD]Survey Period[/TD]
[TD]Normalized Score[/TD]
[TD] Diff vs Preop[/TD]
[/TR]
[TR]
[TD]IDK 1[/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]pre-op[/TD]
[TD="align: right"]63.89[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6 wk[/TD]
[TD="align: right"]97.22[/TD]
[TD] 97.22-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]12 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]24 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]52 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD]IDK 2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]pre-op[/TD]
[TD="align: right"]41.67[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6 wk[/TD]
[TD="align: right"]58.33[/TD]
[TD] 58.33-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]12 wk[/TD]
[TD="align: right"]52.78[/TD]
[TD] 52.78-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]24 wk[/TD]
[TD="align: right"]50.00[/TD]
[TD] 50-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]52 wk[/TD]
[TD="align: right"]52.78 [/TD]
[TD]52.78-41.67[/TD]
[/TR]
</tbody>[/TABLE]
How can I have the macro "search for" the next pre-op entry, then use the corresponding normalized score (which is not in the next column, but several columns away, so select for the rightmost cell with a value in that row) to calculate the differences between the pre-op score and scores at 6, 12, 24, and 52 weeks? Some series only have up to 24 weeks, others up to 12 weeks. There is an empty row between each series, so the difference formula should be applied to the bottom-most row with a value.
If anything unclear, please post questions below. Thanks!
I would like to code something simple to automate the following process:
[TABLE="width: 337"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD] [/TD]
[TD]Survey Period[/TD]
[TD]Normalized Score[/TD]
[TD] Diff vs Preop[/TD]
[/TR]
[TR]
[TD]IDK 1[/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]pre-op[/TD]
[TD="align: right"]63.89[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6 wk[/TD]
[TD="align: right"]97.22[/TD]
[TD] 97.22-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]12 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]24 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]52 wk[/TD]
[TD="align: right"]100.00[/TD]
[TD] 100-63.89[/TD]
[/TR]
[TR]
[TD]IDK 2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]pre-op[/TD]
[TD="align: right"]41.67[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6 wk[/TD]
[TD="align: right"]58.33[/TD]
[TD] 58.33-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]12 wk[/TD]
[TD="align: right"]52.78[/TD]
[TD] 52.78-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]24 wk[/TD]
[TD="align: right"]50.00[/TD]
[TD] 50-41.67[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]52 wk[/TD]
[TD="align: right"]52.78 [/TD]
[TD]52.78-41.67[/TD]
[/TR]
</tbody>[/TABLE]
How can I have the macro "search for" the next pre-op entry, then use the corresponding normalized score (which is not in the next column, but several columns away, so select for the rightmost cell with a value in that row) to calculate the differences between the pre-op score and scores at 6, 12, 24, and 52 weeks? Some series only have up to 24 weeks, others up to 12 weeks. There is an empty row between each series, so the difference formula should be applied to the bottom-most row with a value.
If anything unclear, please post questions below. Thanks!