Find & replace Japanese to English

my8950

Board Regular
Joined
May 1, 2009
Messages
162
Trying to create a tool to convert Japanese characters to English.

I use a software tool that generates a CSV file, problem for me is, most of the column names are Japanese.
What I have done so far is copy the Japanese and input to column B in spreadsheet, and then put google translate into column C.
I'm on my 150th term and I still have many to go.
I figured I should start working on this to see if it is logical to even try.
Basically I want to make a tool that will look in the output file and find any of the terms in Column B, and convert them to column C.

Does this sound do-able? I think so, but I'm looking for some suggestions and ideas.

Thank you!
 
Is it possible to use a simple vlookup? I would just set up a mapping table and then add things as you go....

Note: Japanese Characters have been rendered as ???? but, I tested with real Japanese characters and the Vlookup() works no problem....


Excel 2010
ABCDE
1JapeneseEnglish Translation???Some Stuff 3
2????Some Stuff 1????Some Stuff 1
3????Some Stuff 2
4???Some Stuff 3
Sheet1
Cell Formulas
RangeFormula
E1=VLOOKUP(D1,$A$1:$B$4,2,FALSE)
E2=VLOOKUP(D2,$A$1:$B$4,2,FALSE)

[TABLE="width: 85%"]
<tbody></tbody>[/TABLE]
 
Last edited:
Upvote 0
Wouldn't I need to create that on a blank page and reference the output page from the software tool?
Maybe sheet1 I copy the output from the software tool
Sheet 2 has my A = B conversion
Sheet 3 would contain the VLOOKUP formulas referencing sheet 1?
 
Upvote 0
For example:
( ファイナル比 ) equals ( Final Ratio )

I put parentheses and a space before and after, that is not in my original conversion list.
The japanese word is in B7 and what I want to replace it with is in C7.

I have B1 - B116 containing the Japanese and C 1 - C116 containing the English conversion.

I want to search the B* column and if found, replace with the corresponding C* column location.

basically like a Control F, find XXX and Replace All with YYY.
 
Last edited:
Upvote 0
I think you can just use a vlookup based on your description but if you want something else here is some code to accomplish your goal too:

Code:
[COLOR=#0000ff]Sub [/COLOR]TransLate()


[COLOR=#008000]    'Declare Variables[/COLOR]
    [COLOR=#0000ff]Dim[/COLOR] LngLp [COLOR=#0000ff]As Long[/COLOR]
 [COLOR=#0000ff]   Dim[/COLOR] LRow[COLOR=#0000ff] As Long[/COLOR]
[COLOR=#0000ff]    Dim [/COLOR]refSht [COLOR=#0000ff]As [/COLOR]Worksheet
[COLOR=#0000ff]    Dim [/COLOR]ReplcRng [COLOR=#0000ff]As[/COLOR] Range
    
[COLOR=#0000ff]    Set[/COLOR] refSht = Sheets("YourRefTable")
[COLOR=#0000ff]    Set[/COLOR] ReplcRng = Sheets("ReplaceMe").Range("A1:A10")[COLOR=#008000] 'Your Replace Range Here[/COLOR]
 
    LRow = refSht.Cells(Rows.Count, "B").End(xlUp).Row [COLOR=#008000]'Define Last Row based on coluimn B of refSht[/COLOR]
    
[COLOR=#0000ff]    For[/COLOR] LngLp = 1 [COLOR=#0000ff]To [/COLOR]LRow
[COLOR=#008000]        'Find and Replace Data[/COLOR]
        ReplcRng.Replace What:=refSht.Cells(LngLp, "A"), Replacement:=refSht.Cells(LngLp, "B"), LookAt:=xlPart
[COLOR=#0000ff]    Next [/COLOR]LngLp
    
[COLOR=#0000ff]End Sub[/COLOR]

BEFORE:

Excel 2010
AB
11One
22Two
33Three
44Four
55Five
YourRefTable




Excel 2010
A
11
21
31
42
52
62
73
83
93
104
ReplaceMe



AFTER:


Excel 2010
A
1One
2One
3One
4Two
5Two
6Two
7Three
8Three
9Three
10Four
ReplaceMe
 
Upvote 0
Thank you for your time and help.
I'll give this a try and see if I can adapt it to what I'm doing.
 
Upvote 0
Seems to have trouble here:
Set refSht = Sheets("YourRefTable")

The Japanese that I want to convert, or my reference table is here:
=find!B2:B117
The corresponding English term is here:
=find!C2:C117

Sheet with my conversions is called find.

I tried a few different ways to enter, but no luck.
The code gets stuck in these lines.
- Set refSht = Sheets("=find!B2:B117")
- Set ReplcRng = Sheets("ReplaceMe").Range("=find!C2:C117") 'Your Replace Range Here

As you can see/tell, I'm "beginner" level here, if that...
 
Last edited:
Upvote 0
I've added additional notations in order to help. Please see text in red and green

Code:
Sub TransLate()


    'Declare Variables
    Dim LngLp As Long
    Dim LRow As Long
    Dim refSht As Worksheet
    Dim ReplcRng As Range
    
    Set refSht = Sheets("[B][COLOR=#ff0000]Find[/COLOR][/B]")[COLOR=#008000] 'Define sheet with find items[/COLOR]
    Set ReplcRng = Sheets("[B][COLOR=#ff0000]ReplaceMe[/COLOR][/B]").Range("[B][COLOR=#ff0000]A1:A10[/COLOR][/B]") [COLOR=#008000]'Your Replace Range Here Change Sheet Name and Range[/COLOR]
 
    LRow = refSht.Cells(Rows.Count, "B").End(xlUp).Row[COLOR=#008000] 'Define Last Row based on column B of Find Sheet looks like this will be 117 based on your data[/COLOR]
    
    For LngLp = 1 To LRow
[COLOR=#008000]        'Cycle through your Replace Range ....this essentially cycles through all 116 terms and finds and replaces them in your range[/COLOR]
        ReplcRng.Replace What:=refSht.Cells(LngLp, "A"), Replacement:=refSht.Cells(LngLp, "B"), LookAt:=xlPart
    Next LngLp
    
End Sub
 
Upvote 0
Ok, below is what I have so far.

Sub TransLate()


'Declare Variables
Dim LngLp As Long
Dim LRow As Long
Dim refSht As Worksheet
Dim ReplcRng As Range

Set refSht = Sheets("find") 'Define sheet with find items
Set ReplcRng = Sheets("find").Range("B2:B117") 'Your Replace Range Here Change Sheet Name and Range

LRow = refSht.Cells(Rows.Count, "B").End(xlUp).Row 'Define Last Row based on column B of Find Sheet looks like this will be 117 based on your data

For LngLp = 1 To LRow
'Cycle through your Replace Range ....this essentially cycles through all 116 terms and finds and replaces them in your range
ReplcRng.Replace What:=refSht.Cells(LngLp, "B"), Replacement:=refSht.Cells(LngLp, "B"), LookAt:=xlPart
Next LngLp

End Sub

If I replace this B with 117, or B117 it gets angry, runtime error 1004.
LRow = refSht.Cells(Rows.Count, "B").End(xlUp).Row 'Define Last Row based on column B of Find Sheet looks like this will be 117 based on your data

If I leave it as B or C, it will run through without error, but it is also not changing anything.


I had a question also about the find sheet with the Japanese, there is not reference to range for the find terms. Does that matter?
I'd think that in order to get the corresponding English term it would need to match.
Say I have ファイナル比 in sheetname find, Cell B8.
The english translation is in sheetname find, Cell C8.
How would this know to replace one with the other?
 
Upvote 0

Forum statistics

Threads
1,226,835
Messages
6,193,230
Members
453,781
Latest member
Buzby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top