How to compare excel values and replace it

i have 2 excel files

in excel file there is address and Abbreviation of the address
and in another excel i have state name and state code

i will be getting input value differtly every time i want to replace the certain address with i put value from excel sheets.

ex- input value is “261st Judicial District Court, Travis County, Texas”

in this input value i want to replace Judicial District Court with JDC from excel sheet
and Texas with TX from another excel sheet.

and if the input value is “31 District Court, Travis County, Ohio”
out should should be - 31 DC, Travis County, OH

i want to check all the values in excels one by one

Address.xlsx (8.9 KB)
States-abbreviations.xlsx (9.9 KB)

@T_Y_Raju

hi

create two dictionary

dict_abbrevations=dt.asenumerable.todictionary(function(x) x(0).tostring,function(r)

r0).tostring)

dict_address=dt.asenumerable.todictionary(function(x) x(0).tostring,function(r)

r0).tostring)

input is “261st Judical District Court, Travis Country,Texas”

pass the value of the input to dict_abbrevation(“Judical District Court”).tostring gives you the value as JDC

can u help me sending the work flow

is there any other easy method to do?

@T_Y_Raju

Ok iwill share the workflow

newforum.zip (2.9 KB)

No i think

iam getting error as
image

@T_Y_Raju

in the excel there need not be duplicates

please remove the dupliactes

image

make the excel as above

final out is not coming

input value is “261st Judicial District Court, Travis County, Texas

output should be- “261st JDC, Travis County, TX

that should be the output
[/quote]

@T_Y_Raju

image

use this in the assign activity as shown below

outputvalue=inputstr.Replace(courtvalue,finaloutput)

image

state name is not changing it should be TX instead Texas

State name is not changing

@T_Y_Raju

iam updating it wait

use this at last take assign

coutnryvalue=System.Text.RegularExpressions.Regex.Match(inputstr,“[A-Za-z]+$”).Value

final assign use below

finalstr=inputstr.Replace(courtvalue,finaloutput).Replace(countryvalue,dict_state(countryvalue).ToString)

what if the input file has partial match
like Highway Road, District Court, Texas

here it will throw an error ,

output should be Highway Road, DC, TX

@T_Y_Raju

Hi

replace the courtvalue with below assign

courtvalue=System.Text.RegularExpressions.Regex.Match(inputstr,“(District Court)|(Judicial District Court)|(Superior Court)|(Circuit Court)”).Value

Getting error

@T_Y_Raju

dont copy and paste the code

Please type the expression same as given

giving error