tonkerthomas
Board Regular
- Joined
- Feb 12, 2014
- Messages
- 56
Good afternoon everybody
I have a very large table (14000 rows) of contract data, an extract of which I've simplified here. Each row in that table has a contract identifier ("ID") which may or may not be unique, depending on the complexity of the contract. Within each row, there may or may not be an "option" to break and/or an option to renew that contract. Where options do exist, they have identifying numbers. Although there can be break AND renew options in the same row, there will only ever be one of each. Options are not necessarily contract exclusive - they can apply to many IDs, or just one.
My problem is that where there is more than one option to break and/or more than one option to renew, they have been included in my data by adding a row, identical to the row above it in every aspect except the option ID, thus:
[TABLE="class: grid, width: 600, align: center"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Break 1[/TD]
[TD]Break 2[/TD]
[TD]Break 3[/TD]
[TD]Break 4[/TD]
[TD]Renew 1[/TD]
[TD]Renew 2[/TD]
[TD]Renew 3[/TD]
[TD]Renew 4[/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4102[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4202[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4105[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4206[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4104[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4117[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4203[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I need to consolidate this data. Where the IDs are the same but there are differing values in the Break 1 and/or Renew 1 columns, then whatever is in the second (third, fourth) row of the data needs to move into a new column in one row, thus:
[TABLE="class: grid, width: 600, align: center"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Break 1[/TD]
[TD]Break 2[/TD]
[TD]Break 3[/TD]
[TD]Break 4[/TD]
[TD]Renew 1[/TD]
[TD]Renew 2[/TD]
[TD]Renew 3[/TD]
[TD]Renew 4[/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4102[/TD]
[TD]4105[/TD]
[TD]4104[/TD]
[TD]4117[/TD]
[TD]4202[/TD]
[TD]4206[/TD]
[TD]4211
[/TD]
[TD]4203[/TD]
[/TR]
</tbody>[/TABLE]
There can be anywhere between one and four rows per contract, but there will never be more than four. As in my "before" example, the extra columns for the additional options are already in the table and are currently empty. Once the options have been moved, the rows which previously held them need to be deleted.
Again, this process only applies to rows which share an ID. Where the IDs are not the same, I don't need to do anything.
Does that make sense? Can anybody help me? I assume this will be a VBA job, but if there's some way of doing it with formula logic, I'm all ears.
Many, many thanks in advance to you all.
Jeff
I have a very large table (14000 rows) of contract data, an extract of which I've simplified here. Each row in that table has a contract identifier ("ID") which may or may not be unique, depending on the complexity of the contract. Within each row, there may or may not be an "option" to break and/or an option to renew that contract. Where options do exist, they have identifying numbers. Although there can be break AND renew options in the same row, there will only ever be one of each. Options are not necessarily contract exclusive - they can apply to many IDs, or just one.
My problem is that where there is more than one option to break and/or more than one option to renew, they have been included in my data by adding a row, identical to the row above it in every aspect except the option ID, thus:
[TABLE="class: grid, width: 600, align: center"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Break 1[/TD]
[TD]Break 2[/TD]
[TD]Break 3[/TD]
[TD]Break 4[/TD]
[TD]Renew 1[/TD]
[TD]Renew 2[/TD]
[TD]Renew 3[/TD]
[TD]Renew 4[/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4102[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4202[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4105[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4206[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4104[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4117[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4203[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I need to consolidate this data. Where the IDs are the same but there are differing values in the Break 1 and/or Renew 1 columns, then whatever is in the second (third, fourth) row of the data needs to move into a new column in one row, thus:
[TABLE="class: grid, width: 600, align: center"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Break 1[/TD]
[TD]Break 2[/TD]
[TD]Break 3[/TD]
[TD]Break 4[/TD]
[TD]Renew 1[/TD]
[TD]Renew 2[/TD]
[TD]Renew 3[/TD]
[TD]Renew 4[/TD]
[/TR]
[TR]
[TD]867[/TD]
[TD]4102[/TD]
[TD]4105[/TD]
[TD]4104[/TD]
[TD]4117[/TD]
[TD]4202[/TD]
[TD]4206[/TD]
[TD]4211
[/TD]
[TD]4203[/TD]
[/TR]
</tbody>[/TABLE]
There can be anywhere between one and four rows per contract, but there will never be more than four. As in my "before" example, the extra columns for the additional options are already in the table and are currently empty. Once the options have been moved, the rows which previously held them need to be deleted.
Again, this process only applies to rows which share an ID. Where the IDs are not the same, I don't need to do anything.
Does that make sense? Can anybody help me? I assume this will be a VBA job, but if there's some way of doing it with formula logic, I'm all ears.
Many, many thanks in advance to you all.
Jeff