We would need to understand with more sample data what is actually required to be done. Considering the case provided, the search string contains more words than the one in the Excel sheet column. Maybe if this is the case, we could try with the below Linq Query :
Here, DT is the Datatable which contains the data from the Excel sheet, searchValue is the input text to search, extractedValue is a String type variable.
We might need to handle exceptions but let us know more about different cases.
for example this is my address text
5 14 ST THOMAS STREET BRONTE 2024 61409576525
In this address text BRONTE is my suburb
Need to compare suburb with the filter data
Extracted postal code 2024 and filtered in below excel sheet SYD.zip (23.3 KB)
Another example
20 OLD FARM PLACE OURIMBAH 2258 AU473935456
In this text OURIMBAH is the suburb
need to compare this suburb with below excel
a={ “BENNELONG POINT”, “CENTRAL STATION”, “CHINATOWN”, “CIRCULAR QUAY”, “COCKLE BAY WHARF”, “DARLING HARBOUR”, “DAWES POINT”, “GARDEN ISLAND”, “HAYMARKET”, “MARTIN PLACE”, “MILLERS POINT”, “ST JAMES”, “SYDNEY”, “SYDNEY CBD”, “SYDNEY GPO”, “SYDNEY TOWN HALL”, “THE DOMAIN”, “THE ROCKS”, “UNIVERSITY OF TECHNOLOGY”, “WALSH BAY”, “WHITLAM SQUARE”, “WYNYARD”, “BARANGAROO”, “AS DIRECTED”, “CIRCULAR QUAY WEST”, “King Street Wharf”, “SYDNEY CENTRAL RAIL STATION” }
this is the array
address suburb is “MILLERS POINT NSW”
compare this suburb with above array and i need maximum match
We would need to understand what is meant by max match count for your case. Also indicating which is the required value to be selected will help us in analysing the logic used or confirmation on the logic to be applied.