Find / Search Duplicate Values in slash or (-) character Data in one cell

mianmithu

New Member
Joined
Jan 13, 2020
Messages
24
Office Version
  1. 365
  2. 2010
  3. 2007
Platform
  1. Windows
I want to find a value among the multiple values in one cell, I hope the given picture will help understanding the actual issue.

Hope to get some solution from some Mr. Excel :)

P.S :- Please i need some formula instead of VB Code
 

Attachments

  • Formula MrExcel.png
    Formula MrExcel.png
    32.6 KB · Views: 25

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I want to check If the Gatepass is duplicate, or if the Voucher is Duplicate, or if the Gatepass and Voucher both are Duplicates
 
Upvote 0
@mianmithu
The below may help with the Gate Pass duplicates.
Book1
DEFGHIJKL
1Gate PassSaleReturnProductionPrevQualityDateGP Issue
2925002034655500دھنک "45 - 54x5201/01/2020 
3102500436182200سوس لان 100/201/01/2020 
4116002397300اسٹیپل "44 - 46x4401/01/2020 
51240004160800کھدر "46 - 69x2601/01/2020 
6131500015377900کاٹن "61 - 96x8801/01/2020 
711100050451,100کاٹن "47 - 80x6401/01/2020DUP-GP
8189000102972,50046" - 80x80/80x8001/01/2020 
91950000400656042,600بوسکی01/01/2020 
102018002023100سوک لان "50 105x10501/01/2020 
11181701212050کاٹن "61 90x7001/01/2020DUP-GP
12605405کاٹن "49 90x7001/01/2020 
136888818کاٹن52 "47 78x7801/01/2020 
14 
March
Cell Formulas
RangeFormula
L2:L14L2=IF(IFERROR(AND(COUNTIF($D$1:$D$2000,D2)>1,ROW(D2)<>MATCH(D2,$D$1:$D$200,0)),FALSE),"DUP-GP","")


The Voucher checking is nowhere near as straight forward. I will have a look and see if I can come up with something.
I think you may need to have seperate columns to check each since, any single formula will likely get big and ugly.

Question: Might you have multiple duplicates of the same VC ?
 
Upvote 0
Sir, I dnt want to check the whole column but till the row i am working on
As just for the Gatepass, I used =IF(COUNTIF(D$2:D2,D3)>=1,"Dup-GP","") in L3 and copied it toward down and its ok.
The Same way i want to check if there is any duplicate voucher being put twice

Ans: Sir, unit is sending me reports on daily basis and my responsibility is to check every activity if workers of unit are not doing any fraud with the organization
So in case they send me the same voucher number with tempered date in hundreds of documents and i put the voucher number without noticing that same voucher number was provided already... Then how could i find the fraud activity. So i am trying to use function to find duplicates

ABCDEFGHIJKL
RemarksRemaining StockVoucherGate PassSaleReturnProductionPrevQualityDateIssues
32,675141925002034655500Fabric 101-01
4,33,882142-143-144102500436182200Fabric 201-01=IF(COUNTIF(D$2:D2,D3)>=1,"Dup-GP","")
99145-146-147-148116002397300Fabric 301-01
960149-1501240004160800Fabric 401-01
1,277151131500015377900Fabric 501-01
5,14515211100050451,100Fabric 601-01Dup-GP
3,797153189000102972,500Polyster 101-01
18,604145-154-1561950000400656042,600Polyster 201-01Dup-V
3231472018002023100Polyster 301-01Dup-V
12,000141-155181701212050Polyster 401-01D-GPV
605605405Polyster 501-01
68,9066888818Polyster 601-01
 
Upvote 0
I'm struggling to do Voucher without use of helper columns.
Helpers can be hidden but you would need as many helpers as the max number of vouchers per cell.
The below has 4. The formula in N2 will drag across and down as required.

Book1
BCDELMNOPQ
1Remaining StockVoucherGate PassSaleGP IssueVoucher IssueHelper1Helper2Helper3Helper4
232,67514192500141   
34,33,882142-143-144102500  142143144 
499145-146-147-14811600  145146147148
5960149-150124000  149150  
61,2771511315000  151   
75,145152111000Dup-GP 152   
83,797153189000  153   
918,604145-154-1561950000 Dup-V145154156 
10323147201800 Dup-V147   
1112,000141-15518170Dup-GPDup-V141155  
12605      
1368,906      
March
Cell Formulas
RangeFormula
N2:Q2, N3:Q13N2=TRIM(MID(SUBSTITUTE($C2,"-",REPT(" ",100)),(100*(COLUMNS($N:N)-1))+1,100))
L3:L13L3=IF(COUNTIF(D$2:D2,D3)>=1,"Dup-GP","")
M3:M13M3=IF((COUNTIFS(N$2:Q2,N3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,O3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,P3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,Q3,N$2:Q2,">"""))>0,"Dup-V","")


Hope that helps.
 
Upvote 0
This is a very good idea until the voucher numbers are not too many in the same cell. Its perfectly working for the time being i managed for the maximum 6 vouchers per cell. Thanks a bunch Sir... Salute to you :) Have a very great day with a lot of best wishes

I'm struggling to do Voucher without use of helper columns.
Helpers can be hidden but you would need as many helpers as the max number of vouchers per cell.
The below has 4. The formula in N2 will drag across and down as required.

Book1
BCDELMNOPQ
1Remaining StockVoucherGate PassSaleGP IssueVoucher IssueHelper1Helper2Helper3Helper4
232,67514192500141   
34,33,882142-143-144102500  142143144 
499145-146-147-14811600  145146147148
5960149-150124000  149150  
61,2771511315000  151   
75,145152111000Dup-GP 152   
83,797153189000  153   
918,604145-154-1561950000 Dup-V145154156 
10323147201800 Dup-V147   
1112,000141-15518170Dup-GPDup-V141155  
12605      
1368,906      
March
Cell Formulas
RangeFormula
N2:Q2, N3:Q13N2=TRIM(MID(SUBSTITUTE($C2,"-",REPT(" ",100)),(100*(COLUMNS($N:N)-1))+1,100))
L3:L13L3=IF(COUNTIF(D$2:D2,D3)>=1,"Dup-GP","")
M3:M13M3=IF((COUNTIFS(N$2:Q2,N3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,O3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,P3,N$2:Q2,">""")+COUNTIFS(N$2:Q2,Q3,N$2:Q2,">"""))>0,"Dup-V","")


Hope that helps.
 
Upvote 0
Still, You are really right by
"I'm struggling to do Voucher without use of helper columns.
Helpers can be hidden but you would need as many helpers as the max number of vouchers per cell."


So waiting for the best without using helper columns so in future if vouchers are more than 10 then it will be too ugly for me to use many columns and their references...
I'm struggling to do Voucher without use of helper columns.
Helpers can be hidden but you would need as many helpers as the max number of vouchers per cell.
 
Upvote 0
So waiting for the best without using helper columns so in future if vouchers are more than 10 then it will be too ugly for me to use many columns and their references...

How about:
1. Using UDF (User Defined Function), it means using vba.
2. In col L, it shows the duplicated item (e.g 145) not just saying there's a duplicate.

You don't need any helper column.
Let me know if you're interested in this method.
 
Upvote 0
How about:
1. Using UDF (User Defined Function), it means using vba.
2. In col L, it shows the duplicated item (e.g 145) not just saying there's a duplicate.

You don't need any helper column.
Let me know if you're interested in this method.
I would love to get the duplicated digit instead getting just a hint as the workbook already been little bit heavy due to helper column formulation

But i dnt know the way to use vba and meanwhile i have many worksheets in this workbook i am afraid if these other sheets will be ceeating issues or if the workbook will be heavy

To be honest i dnt knw much about vba and its affects and the way it works

I have few questions abt it plz increase my knowledge as well about vba

I have alot of other workbooks with alot of formats and the mixture of mutliple formulas more than 5 rows long in each cell
So according to my fear i have a thought if i use macro in one sheet
The whole workbooks will create disturbance for me as whenever i ll try to save 'em they will ask for something to do

While working on some workbook
A pop up comes within the passage of time after every distance of time
I have to change formats, formulas, make new sheets etc
Will vba or macro create any disturbance for other workbooks or sheets in same workbook?
 
Upvote 0
Will vba or macro create any disturbance for other workbooks or sheets in same workbook?
Well, VBA can create problems if it's too complicated or flawed. But the UDF I'm offering is simple, so I don't think it will be a problem. But I don't know your workbook so I can't guarantee it. So I think you can try it to see how it works.

Note:
  • You need to change your file to .xlsm format to work with vba.
  • I changed the data a bit to show how it works.
  • I use col L & M to show duplicate items in Voucher & Gate Pass
  • The UDF are getDup1 & getDup2

How to use UDF (User Defined Function):
1. Insert a Module in the workbook.
2. Copy the code then paste into the module.
3. Back to your sheet, now you can use the function.

or you can read this link:
how-to-create-custom-excel-functions

The workbook:
example

VBA Code:
Function getDup1(c As Range, z As Range) As String
Dim i As Long
Dim tx As String
Dim va
Dim d As Object

Set d = CreateObject("scripting.dictionary"): d.CompareMode = vbTextCompare

If c.Cells.Count = 1 Then
    d(CStr(c.Value)) = Empty
Else
    va = c
    For i = 1 To UBound(va, 1)
        For Each x In Split(va(i, 1), "-")
        d(CStr(x)) = Empty
        Next
    Next

End If
    For Each x In Split(z.Value, "-")
        If d.exists(x) Then tx = tx & "," & x
    Next
getDup1 = Mid(tx, 2)

End Function


Function getDup2(c As Range, z As Range) As String

Dim i As Long
Dim tx As String
Dim va
Dim d As Object

Set d = CreateObject("scripting.dictionary"): d.CompareMode = vbTextCompare

If c.Cells.Count = 1 Then
    d(CStr(c.Value)) = Empty
Else
    va = c
    For i = 1 To UBound(va, 1)
        d(CStr(va(i, 1))) = Empty
    Next

End If
    
        If d.exists(CStr(z.Value)) Then tx = tx & "," & z.Value
    
getDup2 = Mid(tx, 2)

End Function

UDF - find-search-duplicate-values-in-slash-or-character-data-in-one-cell.1120530.xlsm
ABCDEFGHIJKLM
1RemarksRemaining StockVoucherGate PassSaleReturnProductionPrevQualityDateVoucher dupGP DUP
232,675142925002034655500Fabric 101-Jan
34,33,882142-143-144102500436182200Fabric 201-Jan142 
499145-146-147-148116002397300Fabric 301-Jan  
5960149-1501240004160800Fabric 401-Jan  
61,277153131500015377900Fabric 501-Jan  
75,14515211100050451,100Fabric 601-Jan 11
83,797145-148189000102972,500Polyster 101-Jan145,148 
918,604145-154-1561950000400656042,600Polyster 201-Jan145 
103231472018002023100Polyster 301-Jan147 
1112,000141-155181701212050Polyster 401-Jan 18
12605605405Polyster 501-Jan  
1368,9066888818Polyster 601-Jan  
Sheet1
Cell Formulas
RangeFormula
L3:L13L3=getDup1(C$2:C2,C3)
M3:M13M3=getDup2(D$2:D2,D3)
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,093
Members
448,944
Latest member
SarahSomethingExcel100

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