How to delete the specific row which has duplicate value in mentioned columb by keeping other duplicate as it is

I have an requirement where in, I need to delete the row containing duplicate value but not all some specific duplications only which has similar pattern too.

Column0 Column1
J-MN.12345.B
A123.XY cat
A153.XY dog
A153.XY cow
A143.XY qwe
A423.XY cat
J-MN.12345.B
A256.XY ert
A176.XY egg
A153.XY wsx
A723.XY cvb
A163.XY apple
A222.XY egg
A333.XY werr
A111.XY qwerty
J-MN.9999.B
A890.XY bvc
A673.XY mnb
A087.XY nbv
In above I don’t want to delete row of a cat but want to delete - J-MN.9999.B
cat egg should not get deleted even if duplicate as it has values in column 0.

I want below output:

Column0 Column1
A123.XY J-MN.12345.B
A153.XY J-MN.12345.B
A153.XY J-MN.12345.B
A143.XY J-MN.12345.B
A423.XY J-MN.12345.B
A256.XY J-MN.12345.B
A176.XY J-MN.12345.B
A153.XY J-MN.12345.B
A723.XY J-MN.12345.B
A163.XY J-MN.12345.B
A222.XY J-MN.12345.B
A333.XY J-MN.12345.B
A111.XY J-MN.12345.B
A890.XY J-MN.9999.B
A673.XY J-MN.9999.B
A087.XY J-MN.9999.B

excel is attached , output can be in sheet2 of same excel :slight_smile: please help.

ioexcel.xlsx (9.3 KB)

@1a2bc346dgjk7544ebjkkbvf

outputdt=

dt.AsEnumerable.Where(Function(x) x.ItemArray.All(Function(r) Not String.IsNullOrEmpty(r.ToString))).CopyToDataTable

removeemptyrows.zip (9.1 KB)

cheers

1 Like

Hello @1a2bc346dgjk7544ebjkkbvf
testprocess.zip (17.3 KB)
Here is the code. you can check. perfect your output as you said. check sheet2 from temp.xlsx

Hope this will solve your problem
Regards
Shubham

Thanks a lot Its working :slight_smile:

Column0 Column1
Z J-MN.12345.B
A123.XY cat
A153.XY dog
A153.XY cow
A143.XY qwe
A423.XY cat
Z J-MN.12345.B
A256.XY ert
A176.XY egg
A153.XY wsx
A723.XY cvb
A163.XY apple
A222.XY egg
A333.XY werr
A111.XY qwerty
X J-MN.9999.B
A890.XY bvc
A673.XY mnb
A087.XY nbv

hi your provided solution worked for me but , You can see z and X in 1st column I want to keep them as it is …means 1st Z , 2nd repeatation is anyway has to delete that row. Can you help if possible ?

[quote=“1a2bc346dgjk7544ebjkkbvf, post:6, topic:625726”]

Column0 Column1
Z J-MN.12345.B
A123.XY
A153.XY
A153.XY
A143.XY
A423.XY
A256.XY
A176.XY
A153.XY
A723.XY
A163.XY
A222.XY
A333.XY
A111.XY
X J-MN.9999.B
A890.XY
A673.XY
A087.XY

This is expected output now @Shubham_Kinge

hello @1a2bc346dgjk7544ebjkkbvf you can do this. add remove duplicate

1 Like

Hi @Shubham_Kinge ,
This will delete cat, dog , egg but i dont want to delete those.
I want to delete only the row based on 2nd column , where value start with J-MN.9999.B is this is repeated then only 2d row should be removed . rest content can be as it is

@1a2bc346dgjk7544ebjkkbvf please try to place remove activity before writing then it will work.
i am not getting can you please provide proper excel with input sheet and output sheet.

Yes this worked, I forgot the simple activity. Thanks for this help @Shubham_Kinge

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.