Concat Duplicate Data

spyldbrat

Board Regular
Joined
May 5, 2002
Messages
211
Office Version
  1. 365
In col K I have list of locations. In column G, I have list of dates. If column D contains the words "Store-00989" and column G has the same date listed on another row, that shares the specific words in d, then in col E, I want to concat the data to show the location name in G and the words "Shift 1" (Example: Store-00989 Shift 1). If another row contains the same duplicate information, then I would like the words "Shift 1" to read "Shift 2" and so on. If there are no duplicates between D & G that do not meet this criteria, then the result should be location name listed in G.

I am not sure if it is possible to change the # after shift, but I need to make each of these duplicate shifts unique.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I almost follow this. Would help of you'd post a few examples of the data and what you want returned (and use XL2BB, please).
 
Upvote 0
Unfortunately, my company has blocked me downloading add-in's. I hope the screen shot below helps.

Store-00989 shares the date of 9/13 on rows 2, 3 and 7. In Column E, the value should be "Store-00989 Unarmed 1", "Store-00989 Unarmed 2", "Store-00989 Unarmed 3" respectively
Store-00989 shares the date of 9/15 on rows 6 and 10. In Colum E, the value returned should be "Store-00989 Unarmed 1", "Store-00989 Unarmed 2" respectively
Loc-1971 shares the date of 9/16 on rows 8 and 9. In Column E, the value returned is Loc-1971 since it does not contain the specific words "Store-00989" in Col D
As with Loc-1971, lines rows 4 &5 would return the value from Col D.

1600817797332.png
 

Attachments

  • 1600817380387.png
    1600817380387.png
    49.7 KB · Views: 3
Upvote 0
The result on rows 8 and 9 should be "LOC-1971" since they do not contain the words "STORE-00989". Other than that it works! :)

1600819624397.png
 
Upvote 0
Actually, I just figured it out =IF(COUNTIFS(D:D,"Store-00989",G:G,G2)>1,D2&" Unarmed "&COUNTIFS(D$2:D2,D2,G$2:G2,G2),D2)

But what if I wanted to add two conditions? For example, lets say I only want it to add unarmed 1, 2, etc if D contains "Store-00989" AND "Loc-1971"?

1600819800480.png
 
Upvote 0
If "store" is the key to incrementing the Unarmed, then maybe mrshl9898's nice formula could be altered to:

Code:
=IF(AND("Store"=LEFT(D2,5),COUNTIFS(D:D,D2,G:G,G2)>1),D2&" Unarmed "&COUNTIFS(D$2:D2,D2,G$2:G2,G2),D2)

Book4
DEFG
2Store-00989Store-00989 Unarmed 109/13/20
3Store-00989Store-00989 Unarmed 209/13/20
4BL-000154BL-00015409/14/20
5BL-000182BL-00018209/14/20
6Store-00989Store-00989 Unarmed 109/15/20
7Store-00989Store-00989 Unarmed 309/13/20
8Loc-1971Loc-197109/16/20
9Loc-1971Loc-197109/16/20
10Store-00989Store-00989 Unarmed 209/15/20
11Store-11111Store-11111 Unarmed 19/15/2020
12Store-11111Store-11111 Unarmed 29/15/2020
spyldbrat
Cell Formulas
RangeFormula
E2:E12E2=IF(AND("Store"=LEFT(D2,5),COUNTIFS(D:D,D2,G:G,G2)>1),D2&" Unarmed "&COUNTIFS(D$2:D2,D2,G$2:G2,G2),D2)
 
Upvote 0
You could use an OR in your IF

=IF(OR(COUNTIFS(D:D,"Store-00989",G:G,G2)>1,COUNTIFS(D:D,"Loc-1971",G:G,G2)>1),D2&" Unarmed "&COUNTIFS(D$2:D2,D2,G$2:G2,G2),D2)
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

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