Auto-populate sequence

eddiegb1

New Member
Joined
Jan 31, 2017
Messages
9
Hi,

Is there a way to automate the process below?

Auto-populate a column with a sequence number using another column as a lookup.

For example, in the data shown below, auto-populate column C (SH#) with a numeric value in a sequence using the contents in column B (PSharing).
And if the values in B are the same - the numeric value entered in column C will be the same/repeated.

Note:
Rows go up to 20000+. So doing this manually is time-consuming.

[TABLE="width: 164"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Item[/TD]
[TD]PSharing[/TD]
[TD]SH#[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]AA2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]AA2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]AA3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]AA3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]AA3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]AA4[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]AA4[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]AA4[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]AA4[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]AA5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]AA5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]AA5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]AA5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]AA5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]AB2[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]16[/TD]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ABLE]


Thanks,
Eddie
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In a similar vein, in C2 copied down

=N(C1)+(B2<>B1)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
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