Trying to convert text into email with the help of neighbor cell

chmohsin

New Member
Joined
May 25, 2022
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hi everybody, plz help me

i have cells containing email addresses without "at" sign. now I have the website address or domain in the left neighbor cell. I want to use that cell's info to put "at" sign in the right place in the right cell.

example

prioritycargo.com.au nicholasprioritycargo.com.au
publiship.com.au greigrpubliship.com.au
fehlberg.com.au sdfehlbergfehlberg.com.au

also please note that sometimes the value in the left call might not contain the text containing domain. In that case, I want Excel to ignore that.
I hope I have explained it well.

So please advise me a formula or way to do that on entire columns otherwise it will take forever to put manually "at" sign in thousands of cells
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hope this helps.
VBA Code:
Sub test()
Dim buf As String, buf2 As String
Dim i As Long

For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
    buf = Cells(i, 1).Value
    Cells(i, 3).Value = Replace(Cells(i, 2).Value, buf, "@" & buf)
Next
End Sub
 
Upvote 0
Thanks a lot Takae. Its working like a charm. Hats off to you. but a little problem. its only working if domain is in A coulmn, email without @ is in B column and i am running it on C Coulmn.
Whereas in actual, my domain is in E Column, email without @ is in F Column and I want result in G Column. Plz advise or do the modification in code.

Thnaks & Regards
 
Upvote 0
Please use this one.

VBA Code:
Sub test()
Dim buf As String
Dim i As Long

For i = 2 To Cells(Rows.Count, 5).End(xlUp).Row
    buf = Cells(i, 5).Value
    Cells(i, 7).Value = Replace(Cells(i, 6).Value, buf, "@" & buf)
Next
End Sub
 
Upvote 0
Solution
Thanks a lot Takae once again. Its working perfectly fine now. Stay blessed.
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

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