Scan Column and Create Value in Adjacent Cell

slinger52

New Member
Joined
Nov 22, 2016
Messages
2
Trying to have excel scan down a column of dates and insert a value that corresponds to a changing date. As the column is scanned if there are duplicates a value of 2 would be entered in the cell adjacent to the bottom most duplicate cell leaving the the remaining adjacent cells blank. If there is not a duplicate value above then a 1 would be entered in the adjacent cell. Have tried many formulas with no success. Below is an example of the result I am looking for utilizing a snapshot of my data:

[TABLE="width: 158"]
<tbody>[TR]
[TD]2/24/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/24/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3/31/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3/31/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4/29/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4/29/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4/30/2015[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5/29/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/29/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]6/27/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6/27/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]7/29/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7/29/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]8/28/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8/28/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]9/18/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9/18/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]10/13/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/13/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]11/9/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/9/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2/13/2015[/TD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TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]9/13/2015[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]10/14/2015[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]11/9/2015[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]12/4/2015[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2/20/2015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/20/2015[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3/7/2015[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]


Any and all help would be greatly appreciated!!!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Assuming that is starting in row 1, column A.

In B1:
=IF(COUNTIF(A:A,A1)>1,IF(COUNTIF(A:A,A1)=COUNTIF($A$1:A1,A1),2,""),1)

Copy down.
 
Upvote 0

Unknown
AB
1DateResult
202/24/2015 
302/24/20152
403/31/2015
503/31/20152
604/29/2015
704/29/20152
804/30/20151
905/29/2015
1005/29/20152
1106/27/2015
1206/27/20152
1307/29/2015
1407/29/20152
1508/28/2015
1608/28/20152
1709/18/2015
1809/18/20152
1910/13/2015
2010/13/20152
2111/09/2015
2211/09/20152
2302/13/20151
2403/13/20151
2504/10/20151
2604/25/20151
2705/30/20151
2806/26/20151
2907/24/20151
3008/21/20151
3109/20/20151
3210/16/20151
3311/13/20151
3412/23/20151
3502/14/20151
3603/12/20151
3702/05/20151
3803/02/20151
3904/22/20151
4005/18/20151
4106/15/20151
4207/14/20151
4308/04/20151
4409/02/20151
4510/05/20151
4610/29/20151
4711/17/20151
4812/22/20151
4907/11/20151
5008/11/20151
5109/13/20151
5210/14/20151
5311/09/20151
5412/04/20151
5502/20/2015
5602/20/20152
5703/07/20151
Sheet9
Cell Formulas
RangeFormula
B2=IF(A2=A3,"",COUNTIF(INDEX(A$2:A2,LOOKUP(1,MATCH(A$2:A2,A2,0),ROW(A$2:A2)-ROW($A$2)+1)-1):A2,A2))
 
Upvote 0
This does produce a positive result within the sample data, however when applied to the full data set it adds the number of occurrences of the date up. For example once the date 02/24/2015 appears again in the column it then inserts a 3 instead of a 1 or 2? Any thoughts? Thanks so much...

Unknown
AB

<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Result[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]02/24/2015[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]02/24/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]03/31/2015[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]03/31/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]04/29/2015[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]04/29/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]04/30/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]05/29/2015[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]05/29/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]06/27/2015[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]06/27/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]07/29/2015[/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]07/29/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]08/28/2015[/TD]

[TD="align: center"]16[/TD]
[TD="align: right"]08/28/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]17[/TD]
[TD="align: right"]09/18/2015[/TD]

[TD="align: center"]18[/TD]
[TD="align: right"]09/18/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]19[/TD]
[TD="align: right"]10/13/2015[/TD]

[TD="align: center"]20[/TD]
[TD="align: right"]10/13/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]21[/TD]
[TD="align: right"]11/09/2015[/TD]

[TD="align: center"]22[/TD]
[TD="align: right"]11/09/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]23[/TD]
[TD="align: right"]02/13/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]24[/TD]
[TD="align: right"]03/13/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]25[/TD]
[TD="align: right"]04/10/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]26[/TD]
[TD="align: right"]04/25/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]27[/TD]
[TD="align: right"]05/30/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]28[/TD]
[TD="align: right"]06/26/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]29[/TD]
[TD="align: right"]07/24/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]30[/TD]
[TD="align: right"]08/21/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]31[/TD]
[TD="align: right"]09/20/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]32[/TD]
[TD="align: right"]10/16/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]33[/TD]
[TD="align: right"]11/13/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]34[/TD]
[TD="align: right"]12/23/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]35[/TD]
[TD="align: right"]02/14/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]36[/TD]
[TD="align: right"]03/12/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]37[/TD]
[TD="align: right"]02/05/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]38[/TD]
[TD="align: right"]03/02/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]39[/TD]
[TD="align: right"]04/22/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]40[/TD]
[TD="align: right"]05/18/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]41[/TD]
[TD="align: right"]06/15/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]42[/TD]
[TD="align: right"]07/14/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]43[/TD]
[TD="align: right"]08/04/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]44[/TD]
[TD="align: right"]09/02/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]45[/TD]
[TD="align: right"]10/05/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]46[/TD]
[TD="align: right"]10/29/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]47[/TD]
[TD="align: right"]11/17/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]48[/TD]
[TD="align: right"]12/22/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]49[/TD]
[TD="align: right"]07/11/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]50[/TD]
[TD="align: right"]08/11/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]51[/TD]
[TD="align: right"]09/13/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]52[/TD]
[TD="align: right"]10/14/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]53[/TD]
[TD="align: right"]11/09/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]54[/TD]
[TD="align: right"]12/04/2015[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]55[/TD]
[TD="align: right"]02/20/2015[/TD]

[TD="align: center"]56[/TD]
[TD="align: right"]02/20/2015[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]57[/TD]
[TD="align: right"]03/07/2015[/TD]
[TD="align: right"]1[/TD]

</tbody>
Sheet9

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]B2[/TH]
[TD="align: left"]=IF(A2=A3,"",COUNTIF(INDEX(A$2:A2,LOOKUP(1,MATCH(A$2:A2,A2,0),ROW(A$2:A2)-ROW($A$2)+1)-1):A2,A2))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
The formula I posted doesn't do that. How did it not work for you?
 
Upvote 0
Try this:
Code:
[COLOR=#333333]=IF([/COLOR][COLOR=#0000FF]A2=A3,"",IF(COUNTIF([COLOR=#FF0000]INDEX([COLOR=#00FF00]A$2:A2,LOOKUP([COLOR=#800080]1,MATCH([COLOR=#008080]A$2:A2,A2,0[/COLOR]),ROW([COLOR=#008080]A$2:A2[/COLOR])-ROW([COLOR=#008080]$A$2[/COLOR])+1[/COLOR])-1[/COLOR]):A2,A2[/COLOR])>1,2,1)[/COLOR][COLOR=#333333])[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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