Replace multiple occurrence of string with another string in a particular column in excel

excel
activities
string

#1

how do you replace multiple occurrence of a strings with other strings in excel??? with out using switch cases or if loop or write cell… as it takes a lot of time …
i have different values in the column and i need to replace each set of strings with other different strings…

for eg… if a column has values such as… hello,good morning,welcome…(all with multiple occurrences)
i want to replace (all occurrences) of … hello with hi…
good morning with good evening
welcome with thank you

would be really helpful… if i get a sample code using excel itself…

thank you


#2

Did you check how long it takes when you execute hotkeys on excel? If you want to accomplish through a datatable, I think it can be done using Linq.

Ctl+h
old value, new value
Alt+ a
Enter

#3

Like what @vvaidya posted you can execute key combinations that access the Excel menus; by pressing Alt you will see letters appear above the menu options, so maybe Alt+a+m is an option to Remove Duplicates. (for example, Select Range then TypeInto “[k(alt)]am” or Send Hotkey)

Are you wanting to find the unique values in a row or in a column? The solutions might be different. But, you can look into LINQ solutions that are the fastest and more reliable, I think:

You can also convert the table to a string with Output Data Table, then use .Replace if you only want to replace certain words. Probably not the ideal method for your goal of getting rid of duplicates.


#4

thank you!!!

can you please help me with an example… or how to use hot keys and linq…