VBA - Comparing data and add remarks accordingly

iris1007

New Member
Joined
Jun 28, 2017
Messages
31
Hi,
I have a huge excel data which I need to compare the same Part # with same Ref # and add the "First" or "Repeat" in Remarks column, according to the Date.
Below is a sample:
DATEPart #Ref #Remarks
15/2/20160145-5521-114537Z-138804512First
13/3/20180145-5521-114537Z-15142396First
18/11/20160145-5521-114537Z-16548768First
6/12/201607F10-1503260181145214First
30/9/201407F10-1503260182255551420First
11/3/201607F10-1503260182255551420Repeat
14/12/201007F10-15032601822523413G67First
19/1/201607F10-15032601822523413G67Repeat
27/4/201607F10-15032601822523413G67Repeat
28/10/201407F10-15032601822502171First
24/6/201307F10-150326018225762201DFirst
9/6/201107F10-150326018225F0991First
6/9/201607F10-150326018225F0991Repeat
28/10/201107F10-15032601822611AD123First
27/7/201507F10-15032601822611AD123Repeat
27/12/201307F10-150326018ABC22622First
11/5/201507F10-150326018F23201884First
2/8/201607F10-150326018F23201884Repeat
26/1/201707F10-150326018F23201884Repeat
7/2/201207F10-150326018A23267First
3/12/201007F10-150326018A23267Repeat
13/4/201607F10-150326018ZX-10-23809First
21/8/201807F10-150326018ZX-10-23809Repeat
23/7/201407F10-1503260182-A4276-00First
25/4/201607F10-1503260182-A4276-00Repeat
30/4/201307F10-15032601881A-CAA26474First
10/12/201507F10-15032601881A-CBB26680First
14/11/201607F10-15032601881A-CBB26680Repeat
21/8/201707F10-15032601881A-CDD27477First
30/4/2013071-50001-8102F149120021First
10/12/2016071-50001-8102F149120021Repeat
14/11/2015071-50001-8102F149120021Repeat
21/8/2017071-50001-8102F149120021Repeat
<colgroup><col width="129" style="width: 97pt; mso-width-source: userset; mso-width-alt: 4579;"> <col width="181" style="width: 136pt; mso-width-source: userset; mso-width-alt: 6428;"> <col width="122" style="width: 92pt; mso-width-source: userset; mso-width-alt: 4352;"> <col width="80" style="width: 60pt; mso-width-source: userset; mso-width-alt: 2844;"> <tbody> </tbody>

Hope anyone of you can help me. Thank you!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
DATEPart #Ref #Remarkshelper
15/02/20160145-5521-114537Z-138804512First0145-5521-114537Z-138804512
13/03/20180145-5521-114537Z-15142396first0145-5521-114537Z-15142396
18/11/20160145-5521-114537Z-16548768first0145-5521-114537Z-16548768
06/12/201607F10-1503260181145214first07F10-1503260181145214
30/09/201407F10-1503260182255551420first07F10-1503260182255551420
11/03/201607F10-1503260182255551420repeat07F10-1503260182255551420
14/12/201007F10-15032601822523413G67first07F10-15032601822523413G67
19/01/201607F10-15032601822523413G67repeat07F10-15032601822523413G67
27/04/201607F10-15032601822523413G67repeat07F10-15032601822523413G67
28/10/201407F10-15032601822502171first07F10-15032601822502171
24/06/201307F10-150326018225762201Dfirst07F10-150326018225762201D
09/06/201107F10-150326018225F0991first07F10-150326018225F0991
col G
some ref numbers are text others are numbers
I have corrected that
clearly the first row must be a first
formula used to determine the "first" in D3
=IF(SUMPRODUCT(($G$2:G2=G3)*1)=0,"first","repeat")

<colgroup><col><col><col><col span="2"><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
Another option
In D2 copied down
=IF(COUNTIFS($B$2:$B2,B2,$C$2:$C2,C2)=1,"First","Repeat")
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,824
Members
449,470
Latest member
Subhash Chand

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