Select method is not wording for filtering data Table, Please let me Know any another way or solution

Hi , I have Excel data with Columns Name Like “EmpId, Name, Age, Department, Salary, Location”. reference use clicks below Image.

I want to get Data, whose Department is HR. But When I’m using the Select method, Getting error. Please resolve this

Hi @chinnapureddy03

Check if this works for you

Filtred_DT=Your_DT.AsEnumerable().Where(Function(row) row(“Coulmn Name of DT”).ToString=“txt toFilter”).CopyToDataTable()

Below is a related post

This is not working for me. Do we have to import something here ?

@Chand wt error u r getting

Hi @Chand,

Try this syntax:
dt_Emp.Select(“[Department]='”+Filter+“'”)

or simpler:

dt_Emp.Select(“[Department]=‘HR’”)

2 Likes

it worked. thanks

Hello @loginerror
this is not working for me Let see my images


Image3 .

Based upon filter value , I want get result as shown in image 3.

@hkjobs1988,

Please can you explain your code

Provide 07 within single Quote as ‘07’ and try :slightly_smiling_face:

same issue, Can’t find the column

Hello,

I tried one more method , That is also not working to me . Let see below images you will get idea. Please let me know any have alternate method or excel macro codes.



Image5

Please check if there is any space in column header “Division”.

Hello Guys,

Please someone help me as the filter fuction is not working properly foe me as well.