VBA to assign consecutive value based on repeating data?

ABLucas

New Member
Joined
Jun 6, 2017
Messages
2
I have a sheet with tons of payment data that I need to assign an episode value. There are two columns in which there would be repeating data: Column "MRN" and Column "FDOS".

I want to assign a consecutive episode value of 0-5, to each row where the MRN & FDOS are repeating.

Example of how it looks when I manually enter the value in the Episode column. How can I make this less of a manual process?

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]MRN
[/TD]
[TD]Episode
[/TD]
[TD]FDOS
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD][/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD][/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1
[/TD]
[TD]01/02/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1
[/TD]
[TD]01/02/2017
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD][/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD][/TD]
[TD]01/01/2017
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I have a sheet with tons of payment data that I need to assign an episode value. There are two columns in which there would be repeating data: Column "MRN" and Column "FDOS".

I want to assign a consecutive episode value of 0-5, to each row where the MRN & FDOS are repeating.

Example of how it looks when I manually enter the value in the Episode column. How can I make this less of a manual process?

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]MRN
[/TD]
[TD]Episode
[/TD]
[TD]FDOS
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]0[/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]0[/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1
[/TD]
[TD]01/02/2017
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1
[/TD]
[TD]01/02/2017
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]0[/TD]
[TD]01/01/2017
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]0[/TD]
[TD]01/01/2017
[/TD]
[/TR]
</tbody>[/TABLE]

Not sure why it didn't display the "0" on rows 1, 2, 5, 6.

Thanks for any help or guidance!
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top