Delete duplicate rows in excel distinguishing upper and lower case

Hello everyone, I have the following line, which obtains the new lines of a company and shows me the sales of each new line, but I have a problem there are some lines that have uppercase letters and others in lowercase, how can I do so that my linq is not case sensitive
That is, when I run my linq, I get the list of the following new lines
Aceites de café
Aceites de Café
Cold Brew
Extracto
Granulado
Liofilizado
Polvo
VIA

I need only one Aceites de café to come out

This is the linq I have
(From row In dtFinal.AsEnumerable() Where row(“Sociedad”).ToString.Trim.Equals(“Ind Colombiana Cafe S.A.S”) Group row By NF = row.Item(“LINEA NUEVA”).ToString.ToLower​​​​​​ Into Group Select dtFinal.Rows.Add({
NF, Group.Sum(Function(x) If(String.IsNullOrEmpty(x(“Ventas Netas Act”).ToString) Or String.IsNullOrWhiteSpace(x(“Ventas Netas Act”).ToString),0, Convert.ToDouble(x.Item(“Ventas Netas Act”).ToString)))
})).CopyToDataTable​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Hi @Juan_Esteban_Valencia,

You could add .ToLower when you compare the items so case is ignored on the items. I can see one in the linq already but I would add it to all string comparison parts

You can use Distinct to take out only the distinct items. Would have to be placed after you have your .ToLower

1 Like

With the toLower I am achieving it, but it is changing all the results to lowercase and the client does not want it like that, how can I do but without changing everything to lowercase

Hi @Juan_Esteban_Valencia,

In that case, I would try @Greg_Jacobson’s suggestion of Distinct

@Juan_Esteban_Valencia please mark my post as solution if it worked for you.

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