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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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