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
For what it's worth, I've just done the below. Just doing the voucher dupes in M since formula will do GP ?

Book1
CDELM
1VoucherGate PassSaleGP DupesVoucher Dupes
214192500
3142-143-144102500  
4145-146-147-14811600  
5149-150124000  
61511315000  
715211100011 
8153189000  
9999-888-141-666-555-444-333-222-111-123-234-456-567-789-926-537-882-663-145-154-1561950000 141 145
10147201800 147
11141-1551817018141
12  
13  
14  
15  
March
Cell Formulas
RangeFormula
L3:L15L3=IF(COUNTIF(D$2:D2,D3)>=1,D3,"")
M3:M15M3=VDupes(C3)


VBA Code:
Function VDupes(Vcell As Range) As String
Dim Arry As Variant
Dim Crng As Range
Dim rw As Long

rw = Vcell.Row
Set Crng = Range("C2:C" & rw - 1)
Arry = Split(Vcell, "-")
For i = LBound(Arry) To UBound(Arry)
    For Each c In Crng.Cells
        If c Like "*" & Arry(i) & "*" Then
            VDupes = VDupes & Arry(i) & "  "
        End If
    Next
Next i
Debug.Print "Y"
End Function
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Nice & simple code, Snakehips (y)

But I hope all the voucher has the same digit otherwise it won't work correctly. For example, say C6 = 14, then it will be considered duplicate.
 
Upvote 0
** ^^^^If by any chance you test the above then please delete the last line
VBA Code:
 Debug.Print "Y
". as it is irrelevant.
 
Upvote 0
Can be resolved as below....
Book1
BCDELM
1Remaining StockVoucherGate PassSaleGP DupesVoucher Dupes
232,67514192500
34,33,882142-143-144102500  
499145-146-147-14811600  
5960149-150124000  
61,2771511315000  
75,14515211100011 
83,797153189000  
918,604999-888-141-666-555-444-333-222-111-123-234-456-567-789-926-537-882-663-145-154-1561950000 141 145
10323147201800 147
1112,000141-155-14-11817018141 141
126051 1
1368,906  
March
Cell Formulas
RangeFormula
L3:L13L3=IF(COUNTIF(D$2:D2,D3)>=1,D3,"")
M3:M13M3=VDupes(C3)


VBA Code:
Function VDupes(Vcell As Range) As String
Dim Arry As Variant
Dim Crng As Range
Dim rw As Long

rw = Vcell.Row
Set Crng = Range("C2:C" & rw - 1)
Arry = Split(Vcell, "-")
For i = LBound(Arry) To UBound(Arry)
    For Each c In Crng.Cells
        If "-" & c & "-" Like "*-" & Arry(i) & "-*" Then
            VDupes = VDupes & Arry(i) & "  "
        End If
    Next
Next i

End Function
 
Upvote 0
I don't know your workbook so I can't guarantee it. So I think you can try it to see how it works.
1. In case If i dnt feel comfortable with vba
Can i remove the module and come back to simple xls file as it was earlier?
2. Changing this file's extension and recording macro... will it affect other workbooks?

Is there a possible way to send my workbook so you can guess if there could be an issue or not
 
Upvote 0
Dare I say, do not be afraid? Using one or the other of the above UDFs may be the answer to your prayers? ;)
I'm assuming that your current workbook is an independent, stand-alone, workbook? If it is not in, any way, linked to or, from any other workbook then I cannot envisage a change of extension/type having any adverse affect whatsoever.
Surely, the sensible thing would be for you to create a copy of your workbook, saving it as .xlsm and test it?
If all goes wrong, ?, you can forget it and revert back to the original.

You make reference to your being 'heavy' by which I assume you mean resource hungry and slow ?
The introduction of the small amount of UDF will not impact greatly upon that, other than when the UDF related formulas are calculating. I get the impression that you just need to copy down these formulas, once a month, to help you analyse a new set of data? If after that, the voucher data will not change so there will not be a need for the UDF formulas to need to recalculate, you could if you so wish, get rid of the formulas and retain the values, you could Copy > Paste Special >Values on columns L and/or M. ?

Only you will know! Have a play on a copy workbook.
 
Upvote 0
You make reference to your being 'heavy' by which I assume you mean resource hungry and slow ?

I am sorry i was away and its pretty late replying to you.
Being honest let me say, I actually don't use anything until or unless i have a grip on it. Your provided VBA might be the perfect one but in future, if incase i needed to amend or change i ll be in trouble once again. with Formulas i am much more familiar so i wish to have hints regarding it.

Yes, I ended up for the time being with it,
in Helper Column

=MID($C356,COLUMN(A$1)*4-3,3) ( and Dragged horizontal until )
and in the ISSUES Column

=IF(AND((COUNTIFS(N$8:S355,N356,N$8:S355,">""")+COUNTIFS(N$8:S355,O356,N$8:S355,">""")+COUNTIFS(N$8:S355,P356,N$8:S355,">""")+COUNTIFS(N$8:S355,Q356,N$8:S355,">""")+COUNTIFS(N$8:S355,R356,N$8:S355,">""")+COUNTIFS(N$8:S355,S356,N$8:S355,">""")>0),COUNTIF(D$8:D355,D356)>=1),IF(A356="AllowGPV","","D-GPV"),IF(COUNTIF(D$8:D355,D356)>=1,IF(A356="AllowGP","","Dup-GP"),IF((COUNTIFS(N$8:S355,N356,N$8:S355,">""")+COUNTIFS(N$8:S355,O356,N$8:S355,">""")+COUNTIFS(N$8:S355,P356,N$8:S355,">""")+COUNTIFS(N$8:S355,Q356,N$8:S355,">""")>0),IF(A356="AllowV","","Dup-V"),"")))

its working just if i will put vouchers in 3 digits, just want more help regarding helper column function if voucher number is put in 4 digits or 2 digits pls guide
 
Upvote 0

Forum statistics

Threads
1,215,268
Messages
6,123,966
Members
449,137
Latest member
yeti1016

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