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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,573
Messages
6,125,608
Members
449,238
Latest member
wcbyers

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