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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,226,113
Messages
6,189,046
Members
453,522
Latest member
Seeker2025

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