Find first instance, offset and mark

Alphacsulb

Active Member
Joined
Mar 20, 2008
Messages
414
Hi Excel World,

I'm hoping there is a way to automate my process through VBA, or maybe even a formula with the use of helper columns.


I'm primarily concerned with Column C and J and M.
Column C represents a zip code sort for mailing.
Column J represents a consecutive number.
Column M is a list of the unique cells in Column C.

Essentially whenever I find the first instance of the unique cell in C, I want column J to be overwritten with the number 1.

Here is my sample data:
Sheet1

*CDEFGHIJKLM
1*************************SNGLP678816552T38735100512**Unique List
2*************************SNGLP678916556T38939069513***************************SNGLP
3*************************SNGLP6790165163T38111320514*************AUTO**5-DIGIT 95947
4***********AUTO**5-DIGIT 95948679124986T6104485525*************AUTO**5-DIGIT 95948
5***********AUTO**5-DIGIT 959486792249232T6103915526*************AUTO**5-DIGIT 96122
6***********AUTO**5-DIGIT 95948679324945T7938900527************AUTO**MIXED AADC 926
7***********AUTO**5-DIGIT 961227361270192T2893362651***
8***********AUTO**5-DIGIT 961227362270193T2893394552***
9***********AUTO**5-DIGIT 961227363270202T2811143453***
10***********AUTO**5-DIGIT 961227381270249T2893832454***
11**********AUTO**MIXED AADC 9267382976T1622170599***
12**********AUTO**MIXED AADC 92673839752T11081135100***
13**********AUTO**MIXED AADC 92673849753T11079425101***
14**********AUTO**MIXED AADC 92673859757T11112405102***
15**********AUTO**MIXED AADC 92673869767T19341095102***
16**********AUTO**MIXED AADC 92673879768T11103725104***
17**********AUTO**MIXED AADC 92673889774T11031285105***
18*************************SNGLP7389165111T38104766515***
19*************************SNGLP7390165112T38385500516***
20*************************SNGLP7391165118T38108250517***
21***********AUTO**5-DIGIT 95947739227074T2935289533***
22***********AUTO**5-DIGIT 95948744124991T6103877528***
23***********AUTO**5-DIGIT 95948744224992T6937697529***
24***********AUTO**5-DIGIT 95947739227074T2935289534***

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4



The desired result would be:
Sheet1

*CDEFGHIJ
1*************************SNGLP678816552T3873510051
2*************************SNGLP678916556T38939069513
3*************************SNGLP6790165163T38111320514
4***********AUTO**5-DIGIT 95948679124986T610448551
5***********AUTO**5-DIGIT 959486792249232T6103915526
6***********AUTO**5-DIGIT 95948679324945T7938900527
7***********AUTO**5-DIGIT 961227361270192T2893362651
8***********AUTO**5-DIGIT 961227362270193T2893394552
9***********AUTO**5-DIGIT 961227363270202T2811143453
10***********AUTO**5-DIGIT 961227381270249T2893832454
11**********AUTO**MIXED AADC 9267382976T162217051
12**********AUTO**MIXED AADC 92673839752T11081135100
13**********AUTO**MIXED AADC 92673849753T11079425101
14**********AUTO**MIXED AADC 92673859757T11112405102
15**********AUTO**MIXED AADC 92673869767T19341095102
16**********AUTO**MIXED AADC 92673879768T11103725104
17**********AUTO**MIXED AADC 92673889774T11031285105
18*************************SNGLP7389165111T38104766515
19*************************SNGLP7390165112T38385500516
20*************************SNGLP7391165118T38108250517
21***********AUTO**5-DIGIT 95947739227074T293528951
22***********AUTO**5-DIGIT 95948744124991T6103877528
23***********AUTO**5-DIGIT 95948744224992T6937697529
24***********AUTO**5-DIGIT 95947739227074T2935289534

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:233px;"><col style="width:35px;"><col style="width:28px;"><col style="width:28px;"><col style="width:49px;"><col style="width:49px;"><col style="width:14px;"><col style="width:28px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Any leads would be appreciated. :eek:
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Helper column approach - just put the formula in row 1 of the helper column and fill down, it will give you a new j column.

Code:
=if(countif($c$1:c1,c1)=1,1,j1)
 
Last edited:
Upvote 0
Here's the same solution as Ragnar1211 he gets the credit he beat me to it. Mine just shows the results. I copied your original values from column H into the helper column L and the formula in the H column can be copied down.



Excel 2010
BCDEFGHIJKL
1678816552T3873510051**Unique List12
2678916556T38939069513***************************SNGLP13
36790165163T38111320514*************AUTO**5-DIGIT 9594714
4679124986T610448551*************AUTO**5-DIGIT 9594825
56792249232T6103915526*************AUTO**5-DIGIT 9612226
6679324945T7938900527************AUTO**MIXED AADC 92627
77361270192T2893362651***1
87362270193T2893394552***2
97363270202T2811143453***3
107381270249T2893832454***4
117382976T162217051***99
1273839752T11081135100***100
1373849753T11079425101***101
1473859757T11112405102***102
1573869767T19341095102***102
1673879768T11103725104***104
1773889774T11031285105***105
187389165111T38104766515***15
197390165112T38385500516***16
207391165118T38108250517***17
21739227074T293528951***33
22744124991T6103877528***28
23744224992T6937697529***29
24739227074T2935289534***34

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet21

Worksheet Formulas
CellFormula
H1=IF(COUNTIF($A$1:$A1,A1)=1,1,$L1)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,684
Members
448,977
Latest member
dbonilla0331

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