Excel add cell to text

Welcome back to another Excel #formulafriday blog. Today I want to share with you a nice handy Excel tip using a well-known formula. Let’s learn how to insert the contents of an Excel cell into a sentence. This is a really great way to save time if you use the same report every week or month. All you really need to do is update the report with the latest figures!.

Let’s walk through an example of my Monthly Sales Report. Every month I report on Sales Per Region, the standard format is the same every month and the only thing that changes is a handful of cells. Let’s free up some time and get this report a little more automated using the CONCATENATE Function.

Using The CONCATENATE Function.

The syntax of this formula is

=CONCATENATE(TEXT1,TEXT2…)

Up to 255 text entries can be added to the function and each one of them should be separated by a comma.

excel concatenate formula

One point to note, CONCATENATE does NOT add in extra spaces between text, in order to do this, you need to accommodate these extra spaces within the formula. Let’s take a look at an example.

Right, let’s get back to the extract from my report-

Excel Tip - Insert The Contents Of A Cell Into A Text String

Next, all I need to do is combine the text in cells B5:B8 with my monthly sales figures which are automatically updated on the datasheet of my Monthly Sales Report. You can be see these in the screenshot below. My sales figures I want to always refer to in the specified area of my Sales Report are contained in cells C6:C9.

As you have probably noticed we have some formatting on our cells that contain our sales figures for the previous month. So, I need to take into account this formatting for the sales report to not only look good but be easily interpreted.

Let’s get on with some formula fun.

First, we take CONCATENATE which simply combines two or more text strings into one. After that, we just need to separate the text strings with commas.

Building The Formula.

Let’s start with the Northern Region. We have three text strings as even space is classed as a separate text string. We also have to just ensure we force the formatting on the value sales from our data area of the Sale Report.

For the last argument (3) in the formula, we use the TEXT function, which takes two arguments. Firstly, it takes the Value (which we take from our data area of the sales report). We can then declare which formatting we want to use. I just need to hit enter to complete the process.

Now we have the formula set up. I just update the data area of my sales report. That’s all that I need to do. Excel automatically populates the presentation part of my Monthly Sales Report.

What Next? Want More Excel Tips?

If you want more Excel and VBA tips then sign up for my Monthly Newsletter where I share 3 Tips on the first Wednesday of the month and receive my free Ebook, 30 Excel Tips.

1

If you want to see all of the blog posts in the Formula Friday series. Click on the link below

How To Excel At Excel – Formula Friday Blog Posts.

More Excel Tips_New1
Learn Excel With Our Excel Online Courses

Combine text from two or more cells into one cell

You can combine data from multiple cells into a single cell using the Ampersand symbol (&) or the CONCAT function.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Combine data with the Ampersand symbol (&)

  1. Select the cell where you want to put the combined data.

  2. Type = and select the first cell you want to combine.

  3. Type & and use quotation marks with a space enclosed.

  4. Select the next cell you want to combine and press enter. An example formula might be =A2&» «&B2.

Combine data using the CONCAT function

  1. Select the cell where you want to put the combined data.

  2. Type =CONCAT(.

  3. Select the cell you want to combine first.

    Use commas to separate the cells you are combining and use quotation marks to add spaces, commas, or other text.

  4. Close the formula with a parenthesis and press Enter. An example formula might be =CONCAT(A2, » Family»).

Need more help?

Connect with an expert. Learn from live instructors.

See also

TEXTJOIN function

CONCAT function

Merge and unmerge cells

CONCATENATE function

How to avoid broken formulas

Automatically number rows

Need more help?

This is addition to @Edward-Leno ‘s answer for more detail/explanation and cases where the text cells are formulas instead of values, and you want to retain the original formula.

Suppose your cells look like this (formulas)

=»email» & «@» & «address.com»

=A1 & «@» & C1

instead of this (values)

email@address.com

If «email» and «address.com» were some cells like A1 is the email and C1 is the address.com part, then you’d have something like =A1&»@»&C1 which would be important to retain since A1 and C1 might not be constants and can change, so the comma-concatenated values would change, like if C1 is «gmail.com», «yahoo.com», or something else based on its formula.

Values method: The following steps will successfully append text but only keep the value using a scratch column (this works for rows, too, but for simplicity, the directions are for columns)

  1. Assume column A is your data.
  2. In scratch column B, start anywhere like the top of column B such as at B1 and put this formula:

=A1&»,»

Essentially, the «&» is the concatenation operator, combining two strings together (numbers are converted to strings). The «,» can be adjusted to «, » if you want a space after the comma.

  1. Copy the cell B1 and copy it down to all other cells in column B, either by clicking at the bottom right of cell B1 and dragging down, or copying with «Ctrl+C» or right-click > «Copy».

  2. Paste B1 to all cells in column B with «Ctrl+V» or right-click > «Paste Options:» > «Paste». You should see the data looking like you intended.

  3. Copy all cells in column B and paste them to where you want via right-click > «Paste Options:» > «Values». We select values so it doesn’t mess up any formatting or conditional formatting

Formula retention method: The following steps will successfully retain the original formula. The process is similar to the values method, and only step 2, the formula used to concatenate the comma, changes.

  1. Assume column A is your data.
  2. In scratch column B, start anywhere like the top of column B such as at B1 and put this formula:

=FORMULATEXT(A1)&»,»

FORMULATEXT() grabs the formula of the cell as opposed to the value of it, so a simple example would be that it grabs =2+2 instead of 4, or =A1 & «@» & C1 where A1 is «Bob» and C1 is «gmail.com» instead of Bob@gmail.com.

Note: This formula only works for Excel versions 2013 and greater. For alternative equivalent solutions for Excel 2010 and older, see this superuser answer: https://superuser.com/a/894441/495155

  1. Copy the cell B1 and copy it down to all other cells in column B, either by clicking at the bottom right of cell B1 and dragging down, or copying with «Ctrl+C» or right-click > «Copy».

  2. Paste B1 to all cells in column B with «Ctrl+V» or right-click > «Paste Options:» > «Paste». You should see the data looking like you intended.

  3. Copy all cells in column B and paste them to where you want via right-click > «Paste Options:» > «Values». We select values so it doesn’t mess up any formatting or conditional formatting

There may be instances where you need to add the same text to all cells in a column. You might need to add a particular title before names in a list, or a particular symbol at the end of the text in every cell.

The good thing is you don’t need to do this manually.

Excel provides some really simple ways in which you can add text to the beginning and/ or end of the text in a range of cells.

In this tutorial we will see 4 ways to do this:

  • Using the ampersand operator (&)
  • Using the CONCATENATE function
  • Using the Flash Fill feature
  • Using VBA

So let’s get started!

Method 1: Using the ampersand Operator

An ampersand (&) can be used to easily combine text strings in Excel. Let’s see how you use it to add text at the beginning or end or both in Excel.

Using the ampersand Operator to Add Text to the Beginning of all Cells

The ampersand (&) is an operator that is mainly used to join several text strings into one.

Here’s how you can use it to add text to the beginning of all cells in a range. Let us assume you have the following list of names and want to add the title “Prof.” before every name:

Guest list data

Below are the  steps to add  a text before a text string in Excel:

  1. Click on the first cell of the column where you want the converted names to appear (B2).
  2. Type equal sign (=), followed by the text “Prof. “, followed by an ampersand (&).
  3. Select the cell containing the first name (A2).
  4. Press the Return Key.
  5. You will notice that the title “Prof.” is added before the first name in the list.Using formula to add text before the names
  6. It’s now time to copy this formula to the rest of the cells in the column. Simply double click the fill handle (located at the bottom right of cell B2). Alternatively, you can drag down the fill handle to achieve the same effect.

That’s it, all your cells in column B should now contain the title “Prof.” preceding each name.

Result when text is added

Using the ampersand Operator to Add Text to the End of all Cells

Now let us see how to add some text to the end of every name in the dataset. Let us say you want to add the text “(MD)” at the end of every name. In that case, here are the steps you need to follow:

  1. Click on the first cell of the column where you want the converted names to appear (C2 in our case).
  2. Type equal sign (=)
  3. Select the cell containing the first name (B2 in our case).
  4. Next, insert an ampersand (&), followed by the text “ (MD)”.
  5. Press the Return Key.
  6. You will notice that the text “(MD).” added after the first name in the list.Fromula to add text at the end of the string
  7. It’s now time to copy this formula to the rest of the cells in the column. Simply double click the fill handle (located at the bottom right of cell C2). Alternatively, you can drag down the fill handle to achieve the same effect.

All your cells in column C should now contain the text “(MD”) at the end of each name.

Adding text before and after a text string

Method 2: Using the CONCATENATE Function

CONCATENATE is an Excel function that you can use to add text at the beginning and end of the text string.

Let’s see how to use CONCATENATE to do this.

Using CONCATENATE to Add Text to the Beginning of all Cells

The CONCATENATE() function provides the same functionality as the ampersand (&) operator. The only difference is in the way both are used.

The general syntax for the CONCATENATE function is:

=CONCATENATE(text1, [text2], …)

Where text1, text2, etc. are substrings that you want to combine together.

Let’s apply the CONCATENATE function to the same dataset as above:

  1. Click on the first cell of the column where you want the converted names to appear (B2).
  2. Type equal sign (=).
  3. Enter the function CONCATENATE, followed by an opening bracket (.
  4. Type the title “Prof. ” in double-quotes, followed by a comma (,).
  5. Select the cell containing the first name (A2)
  6. Place a closing bracket. In our example, your formula should now be: =CONCATENATE(“Prof. “,A2).
  7. Press the Return Key.
  8. You will notice that the title “Prof.” is added before the first name on the list.CONCATENATE function to add text before the string
  9. It’s now time to copy this formula to the rest of the cells in the column. Simply double click the fill handle (located at the bottom right of cell B2). Alternatively, you can drag down the fill handle to achieve the same effect.

That’s it, all your cells in column B should now contain the title “Prof.” preceding each name.

CONCATENATE formula result

Using CONCATENATE to Add Text to the End of all Cells

Now let us see how to add some text to the end of every name in the dataset. Let us say you want to add the text “(MD)” at the end of every name. In that case, here are the steps you need to follow:

  1. Click on the first cell of the column where you want the converted names to appear (C2 in our example).
  2. Type equal sign (=).
  3. Enter the function CONCATENATE, followed by an opening bracket (.
  4. Select the cell containing the first name (B2 in our example).
  5. Next, insert a comma, followed by the text “ (MD)”.
  6. Place a closing bracket. In our example, your formula should now be: =CONCATENATE(B2,” (MD)”).
  7. Press the Return Key.
  8. You will notice that the text “(MD).” added after the first name in the list.CONCATENATE function to add text after the string
  9. It’s now time to copy this formula to the rest of the cells in the column. Simply double click the fill handle (located at the bottom right of cell C2).

All your cells in column C should now contain the text “(MD”) at the end of each name.

CONCATENATE formula result end

Notice that since you’re using a formula, your column C depends on columns A and B. So if you make any changes to the original values in column A, they get reflected in column C.

If you decide to only retain the converted names and delete columns A and B, you will get an error, as shown below:

Issue when deleting rhe dependent columns

To make sure that this does not happen, it’s best to first convert the formula results to permanent values copying them and pasting them as values in the same column (Right-click and select Paste Options->Values from the Popup menu).

Convert formulas to values

Now you can go ahead and delete columns A and B if you need to.

Also read: How to Remove First Character in Excel?

Method 3: Using the Flash Fill Feature

Flash fill is a relatively new feature that looks at the pattern of what you are trying to achieve and then does it for all the cells in a column.

You can also use Flash fill to so text manipulation as we will see in the following examples.

Using Flash Fill to Add Text to the Beginning of all Cells

The Excel flash fill feature is like a magical button. It is available if you’re on any Excel version from 2013 onwards.

The feature takes advantage of Excel’s pattern recognition capabilities. It basically recognizes a pattern in your data and automatically fills in the other cells of the column with the same pattern for you.

Here’s how you can use Flash Fill to add text to the beginning of all cells in a column:

  1. Click on the first cell of the column where you want the converted names to appear (B2).
  2. Manually type in the text Prof. , followed by the first name of your list.Type the expected result
  3. Press the Return Key.
  4. Click on cell B2 again.
  5. Under the Data tab, click on the Flash Fill button (in the ‘Data Tools’ group). Alternatively, you can just press CTRL+E on your keyboard (Command+E if you’re on a Mac).Click on Flash Fill

This will copy the same pattern to the rest of the cells in the column… in a flash!

Flash fill result

Using Flash Fill to Add Text to the End of all Cells in a Column

If you want to add the text “ (MD)” to the end of the names, follow the same steps:

  1. Click on the first cell of the column where you want the converted names to appear (C2).
  2. Manually type in or copy the text from column B2 into C2.
  3. Add the text “(MD)” after that.Type manually by adding the required text at the end of the string
  4. Under the Data tab, click on the Flash Fill or press CTRL+E on your keyboard (Command+E if you’re on a Mac).

That’s all, you get every cell filled in with the same pattern!

Final result of flash fill

We especially like this method because it is simple, quick, and easy. Moreover, since it’s formula-free, the results do not depend on the original columns.

So they remain unchanged even if you delete rows A and B!

Result in case you delete all the other columns

Method 4: Using VBA Code

And of course, if you’re comfortable with VBA, you can also add text before or after a text string using it.

Using VBA to Add Text to the Beginning of all Cells in a Column

If coding with VBA does not intimidate you then this method can help get your work done quickly too.

Here’s the code we will be using to add the title “Prof. “ to the beginning of all cells in a range. You can select and copy it:

Sub add_text_to_beginning()
Dim rng As Range
Dim cell As Range
Set rng = Application.Selection
For Each cell In rng
cell.Offset(0, 1).Value = "Prof. " & cell.Value
Next cell
End Sub

Follow these steps to use the above code:

  1. From the Developer Menu Ribbon, select Visual Basic.
  2. Once your VBA window opens, Click Insert->Module. Now you can start coding. Type or copy-paste the above lines of code into the module window. Your code is now ready to run.
  3. Select the range of cells containing the text you want to convert. Make sure the column next to it is blank because this is where the code will display the results.
  4. Navigate to Developer->Macros-> add_text_to_beginning->Run.

You will now see the converted text next to your selected range of cells.

Flash fill result

Note: You can change the text in line 6 from “Prof. ” to whatever text you need to add to the beginning of all cells.

Using VBA to Add Text to the End of all Cells in a Column

Now, what if you want to add text to the end of all the cells, instead of the beginning? This only involves making a tweak to line 6 of the above code. So if you want to add the text “ (MD)” to the end of all cells, change line 6 to:

cell.Offset(0, 1).Value = cell.Value & “ (MD)”

So your full code should now be:

Sub add_text_to_end()
Dim rng As Range
Dim cell As Range
Set rng = Application.Selection
For Each cell In rng
cell.Offset(0, 1).Value = cell.Value & " (MD)"
Next cell
End Sub

Here’s the final result:

Final result of flash fill

You can now delete the first two columns if you need to. Do remember to keep a backup of your sheet, because the results of VBA code are usually irreversible.

Note: You can change the text in line 6 from “ (MD)” to whatever text you need to add to the end of all cells in the range.

In this tutorial, we showed you four ways in which you can add text to the beginning and/ or end of all cells in a range.

There are plenty of other methods that you can find online too, and all of them work just as well as the ones shown here.

You may feel free to choose whatever method suits you, your requirement, and your version of Excel. In the end, what matters is getting what you need to be done quickly and effectively.

Other Excel tutorials you may like:

  • How to Remove Text after a Specific Character in Excel
  • How to Reverse a Text String in Excel
  • How to Count How Many Times a Word Appears in Excel
  • How to Remove Commas in Excel (from Numbers or Text String)
  • How to Remove a Specific Character from a String in Excel
  • How to Change Uppercase to Lowercase in Excel
  • How to Separate Address in Excel?
  • How to Concatenate with Line Breaks in Excel?
  • How to Separate Names in Excel

Microsoft Excel has a functionality where we can link a textbox to a specific cell. If we change the data in the cell, the value of the linked cell gets updated automatically. Below are the following steps to link a cell to a text box:

1. Open Excel
2. Click on the Insert tab
3. Click the Text Box button

image1

4. A text Box will Open

image2

5. Select the Text Box
6. Type = in the Formula Bar
7. Select the cell where you want to give a reference

Let us take an example

1. Open Excel
2. Click on the Insert tab
3. Click the Text Box button
4. A text Box will Open
5. Select the Text Box
6. Type = in the Formula Bar
7. Select the cell A1

image3

8. After we select Cell A1, automatically it will display “=$A$1”
9. Now when we change the Text in cell A1, automatically text in the Text Box will change

Понравилась статья? Поделить с друзьями:
  • Excel activesheet pictures insert
  • Excel activecell specialcells 11
  • Excel activecell address vba excel
  • Excel active directory query
  • Excel active cells vba