Solved

create an additional column in an excel spreadsheet using the current column information.

Posted on 2014-02-18
4
225 Views
Last Modified: 2014-02-20
I have an excel spreadsheet that has two columns - firstname and lastname.

I need to create the third column in the format like this:

firstname.lastname@xyz.com

Please advise.
0
Comment
Question by:nav2567
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
5teveo earned 500 total points
ID: 39868483
use this formula

first | Last
A1       B1

=A1&"."&B1&"@xyz.com"
0
 
LVL 81

Expert Comment

by:byundt
ID: 39869507
Here is a macro that will build the email addresses for you. You will need to customize the macro to identify the starting cells for first name, last name and resulting email address. You will also need to change xyz.com to the correct domain.

The macro shows two alternative ways of putting a value in the results column. In one statement, the code inserts a hyperlink. In the other, it inserts plain text. Pick the statement you want, and comment out the other.
Sub EmailAddressBuilder()
Dim rg1 As Range, rg2 As Range, rg3 As Range
Dim i As Long, n As Long
Dim ws As Worksheet
Application.ScreenUpdating = False
Set ws = ActiveSheet
With ws
    Set rg1 = .Range("A2")  'First cell containing a first name
    Set rg2 = .Range("B2")  'First cell containing a family name
    Set rg3 = .Range("C2")  'First cell to contain an email address
    Set rg1 = Range(rg1, .Cells(.Rows.Count, rg1.Column).End(xlUp))
    Set rg2 = Range(rg2, .Cells(.Rows.Count, rg2.Column).End(xlUp))
End With
n = rg1.Cells.Count
For i = 1 To n
    If rg1.Cells(i, 1).Value <> "" And rg2.Cells(i, 1).Value <> "" Then
        ws.Hyperlinks.Add rg3.Cells(i, 1), rg1.Cells(i, 1).Value & "." & rg2.Cells(i, 1).Value & "@xyz.com"     'Add hyperlink
        'rg3.Cells(i, 1).Value = rg1.Cells(i, 1).Value & "." & rg2.Cells(i, 1).Value & "@xyz.com"                'Add plain text
    End If
Next
End Sub

Open in new window

0
 

Author Closing Comment

by:nav2567
ID: 39874598
Thanks, guys.
0
 
LVL 8

Expert Comment

by:5teveo
ID: 39874616
thanks for points... Good luck w/ project
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question