Can you have text and a formula in one cell in excel

  1. Column
  2. TECHNOLOGY Q&A

By Kelly L. Williams, CPA, Ph.D.

Q. Is there a way to include both a formula and text in the same cell?

A. You can include both a formula and text in the same cell in Excel. You can do this in many ways, depending on what you are trying to accomplish. The first screenshot below shows an example of when it may be useful to combine a formula and text in the same cell.

The challenge here is to display a message in cell G31 that includes how many more technical hours a person needs for CPE. In this example, the required total is 40 hours. The total number of hours completed so far is a variable contained in cell E31. So, to display the remaining CPE hours as part of a text string in cell G31, you would type in the following =»You need » & 40-E31 & » more technical hours». With 23 entered into E31 in the example shown in the screenshot below, the message will read «You need 17 more technical hours.» The message will display how many more technical hours are needed and will adjust based on the number in cell E31.

excel-combining-formulas-1

Here are some tips that may not be obvious just looking at the formula. First, you must start with an equal sign so Excel knows it is dealing with a formula. Otherwise, Excel will simply display exactly what you typed and not perform the calculation. Remember to include a space between the last letter and the end quote with «You need «. The space must be included to show up in cell E31.

I included several other spaces in the formula above, but only one of those has to be there. You must have the space between the beginning quote and the first letter in «more technical hours» for that space to be included in the message that appears in cell G31.

As for the other spaces, I included them to make it easier to see the different parts of the text string, the formula, and the «&» signs that connect two halves of the text with the formula. None of the spaces here are required. As you can see in the screenshot below, the formula works without these spaces.

excel-combining-formulas-2

You can access an Excel workbook and accompanying video below for combining a formula and text in the same cell.


About the author

Kelly L. Williams, CPA, Ph.D., MBA, is an associate professor of accounting at the Jones College of Business at Middle Tennessee State University.


Submit a question

Do you have technology questions for this column? Or, after reading an answer, do you have a better solution? Send them to jofatech@aicpa.org.We regret being unable to individually answer all submitted questions.

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 More…Less

We often hear that you want to make data easier to understand by including text in your formulas, such as «2,347 units sold.» To include text in your functions and formulas, surround the text with double quotes («»). The quotes tell Excel it’s dealing with text, and by text, we mean any character, including numbers, spaces, and punctuation. Here’s an example:

=A2&» sold «&B2&» units.»

For this example, pretend the cells in column A contain names, and the cells in column B contain sales numbers. The result would be something like: Buchanan sold 234 units.

The formula uses ampersands (&) to combine the values in columns A and B with the text. Also, notice how the quotes don’t surround cell B2. They enclose the text that comes before and after the cell.

Here’s another example of a common task, adding the date to worksheet. It uses the TEXT and TODAY functions to create a phrase such as «Today is Friday, January 20.»

=»Today is » & TEXT(TODAY(),»dddd, mmmm dd.»)

Let’s see how this one works from the inside out. The TODAY function calculates today’s date, but it displays a number, such as 40679. The TEXT function then converts the number to a readable date by first changing the number to text, and then using «dddd, mmmm dd» to control how the date appears—«Friday, January 20.»

Make sure you surround «ddd, mmmm dd» date format with double quotes, and notice how the format uses commas and spaces. Normally, formulas use commas to separate the arguments—the pieces of data—they need to run. But when you treat commas as text, you can use them whenever you need to.

Finally, the formula uses the & to combine the formatted date with the words «Today is «. And yes, put a space after the «is.»

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

We get the data in the cells of the worksheet in Excel, which is how the Excel worksheet works. We can combine multiple cell data, splitting the single-cell data into numerous cells. That is what makes Excel so flexible to use. Combining data from two or more cells into one cell is not the hardest but not the easiest job. It requires very good knowledge of Excel and systematic Excel. This article will show you how to combine text from two or more cells into one cell.

For example, we have a worksheet consisting of product names (column A) and codes (column B). The given product names are A, B, C, and D, and the codes are 2,4,6 and 8, respectively. We need to combine them into one cell (column C). We can easily combine cells in columns A and B by inserting the formula =A2&B2, =A3&B3, and so on to get a string A2, B4, C6, and D8 in column C.

Table of contents
  • How to Combine Text From Two Or More Cells into One Cell?
    • Examples
      • Example #1 – Using the ampersand (&) Symbol
      • Example #2- Combine Cell Reference Values and Manual Values
    • Recommended Articles

Combine-Text-From-Two-or-More-Cells-into-One-Cell

Examples

Below are examples of combining text from two or more cells into one cell.

You can download this Combine Text to One Cell Excel Template here – Combine Text to One Cell Excel Template

Example #1 – Using the ampersand (&) Symbol

Combine Data to Create a Full Postal Address

While collecting the data from employees, students, or some others, everybody stores the data of full name, last name, address, and additional useful information in parallel columns. Below is a sample of one of those data.

Combine Text Example 1

It is fine when collecting the data, but basic and intermediate level Excel users find it difficult when they want to send some post to the respective employee or student because data is scattered into multiple cells.

Usually, when they send the post to the address, they must frame the address like the one below.

Combine Text Example 1-1

“First Name” and “Last Name” at the top, they need to insert a line breaker, then again they need to combine other address information like “City,” “Country,” “State,” and “Zip Code.” Here, we need the skill to combine text from two or more cells into one cell.

We can combine cells using the built-in Excel function “CONCATENATE Excel functionThe CONCATENATE function in Excel helps the user concatenate or join two or more cell values which may be in the form of characters, strings or numbers.read more” and the ampersand (&) symbol. In this example, we will use only the ampersand symbol.

We must copy the above data into the worksheet.

Combine Text Example 1

Then, we must open an equal sign in the H2 cell and select the first name cell, i.e., the A2 cell.

Combine Text Example 1-2

Put the ampersand sign.

Combine Text Example 1-3

After selecting one value, we need space characters to separate one value from another. So, insert a space character in double quotes.

Combine Text Example 1-4

Now, we must select the second value to be combined, i.e., the last name cell, the B2 cell.

Combine Text Example 1-5

Once the “First Name” and “Last Name” are combined, we need the address in the next line, so we need to insert a line breaker in the same cell.

How do we insert the line breaker is the question now?

We need to make use of the CHAR function in ExcelThe character function in Excel, also known as the char function, identifies the character based on the number or integer accepted by the computer language. For example, the number for character «A» is 65, so if we use =char(65), we get A.read more. Using the number 10 in the CHAR function, we will insert a line breaker. So, we will use CHAR(10).

Combine Text Example 1-6

Now, we must select “Address” and give the space character.

Combine Text Example 1-7

Similarly, we must select other cells and give each cell a one-space character.

Combine Text Example 1-8

Now, we can see the full address in one cell.

Combine Text Example 1-9

Next, we will copy and paste the formula to the below cells.

Combine Text Example 1-10

But we cannot see any line breaker here.

Once the formula is applied, we need to apply the Wrap TextWrap text in Excel belongs to the “Formatting” class of excel function that does not make any changes to the value of the cell but just change the way a sentence is displayed in the cell. This means that a sentence that is formatted as warp text is always the same as that sentence that is not formatted as a wrap text.read more format to the formula cell.

Combine Text Example 1-11

As a result, it will make the proper address format.

Combine Text Example 1-12

Example #2- Combine Cell Reference Values and Manual Values

Not only cell references, but we can also include our values with cell referencesCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1.read more. For example, look at the below data.

Combine Text Example 2

We need to combine the above two columns of data into one with the manual word “came to office at,” and the full sentence should read like the one below.

Example: “James came to the office at 11:53:10 AM.”

Let us copy the above data to Excel and open an equal sign in cell C2. Then, the first value to be combined is cell A2.

CT Example 2-1

Next, we need our manual value. So, we must insert the manual value in double quotes.

CT Example 2-2

Then, we must select the final value, the “Time” cell.

CT Example 2-3

As a result, we can see the full sentences.

CT Example 2-4

Then, we must copy and paste the formula into other cells.

CT Example 2-5

We have one problem here, i.e., the time portion is not properly appearing. The reason why we cannot see proper time is that Excel stores time in decimal serial numbers. Therefore, whenever we combine time with other cells, we need to connect them with proper formatting.

To apply the time format, we need to use TEXT  Formula in Excel with the format “hh:mm:ss AM/PM.”

CT Example 2-6

By using different techniques, we can combine text from two or more cells into one cell.

Recommended Articles

This article is a guide to Combine Text From Two or More Cells into One Cell. We discuss how to combine text from two or more cells into one cell with examples and a downloadable Excel template. You may learn more about Excel from the following articles: –

  • Strikethrough Text in Excel
  • How to Separate Text in Excel?
  • How to Convert Text to Numbers in Excel?
  • How to Convert Numbers to Text in Excel?

Posted by Barrie Davidson on June 08, 2001 11:32 AM

Can you clarify what you want to do by providing an example?

Posted by IML on June 08, 2001 11:37 AM

if A1 and A2 each had 1 in them, then this

=A1+A2&» two»

would return «2 two»

good luck.

Posted by Roni on June 08, 2001 12:04 PM

I understand the adding text formula, but now I have
another issue…same sheet.

I have a formula that calculates the difference (in days)
between two dates. After that calculates, I want the word
«Days» to appear.

The first follow-up suggested &»text» after formula,
which worked brilliantly (thank you), however since the
number, the calculation is a DATE string, it’s very very
long and I can’t seem to find a format that will cut it
off two after the decimal.

Posted by IML on June 08, 2001 12:21 PM

When I use

=+A2-A1&» days»

and the general formal, I think I’m getting the results you are looking for. For example, with 5/25/01 and 5/28/01 in A1 and A2, I get «3 Days» as a result. What is your formula?

Sorry if I’m jumping in on you, Barry.

Good luck.

Posted by Roni on June 08, 2001 12:25 PM

Posted by IML on June 08, 2001 12:32 PM

Very strange, that works for me. You could try the formula =A7-B8 and use the custom format

d «days»

=A7-B8&» days»

Posted by IML on June 08, 2001 12:46 PM

That custom format won’t work. It doesn’t count correctly over more than one month. Sorry, I’m fresh out of ideas. Very strange, that works for me. You could try the formula =A7-B8 and use the custom format d «days»

Posted by Barrie Davidson on June 08, 2001 12:47 PM

IML: No need to apologize…

It’s great to see a problem solved (I frequently learn just as much as the person asking the question), but thanks for the consideration.

Barrie When I use =+A2-A1&» days» and the general formal, I think I’m getting the results you are looking for. For example, with 5/25/01 and 5/28/01 in A1 and A2, I get «3 Days» as a result. What is your formula? Sorry if I’m jumping in on you, Barry. Good luck.

Posted by Barrie Davidson on June 08, 2001 12:50 PM

You could try (I think it will format the number part the way you want it):
=TEXT(A7-B8,»#»)&» days»

Barrie That custom format won’t work. It doesn’t count correctly over more than one month. Sorry, I’m fresh out of ideas. : Very strange, that works for me. You could try the formula =A7-B8 and use the custom format : d «days» :

Posted by SNassau626 on June 08, 2001 1:02 PM

I’m fairly new at this, but since you CAN get the numerical value you’re looking for but can’t add the text «days» (if i understand you correctly), why not let the calculation go into a hidden cell (ie- D1) and then have cell E1= D1 & » Days».

Posted by Roni on June 08, 2001 1:17 PM

that worked. thank you so much. although i don’t understand
why or how or what it did. what does «#» signify?

Thanks again for everyone’s help. You could try (I think it will format the number part the way you want it):

Posted by IML on June 08, 2001 1:20 PM

EURIKA!

That worked for me, too. I still can’t figure why the general format and =A2-A1&» days» worked for me and not Roni.

Posted by Barrie Davidson on June 08, 2001 1:20 PM

Formula explained

Posted by Barrie Davidson on June 08, 2001 1:29 PM

Formula explained (for real this time)

Accidently hit enter in the first post. The formula converts numbers to text. The syntax is:
=Text(value,number format)
so the «#» tells Excel to format the number as a number with no decimals and not commas. Try playing with the format (use «#,###.0» for example).

Barrie :) that worked. thank you so much. although i don’t understand

  1. 10-12-2005, 03:05 PM


    #1

    Can you have a formula followed by text all in one cell?

    Just as the subject askes, I what to have a formula in a cell that the number
    that it puts out is then followed by whatever text i want. Is this possible?


  2. 10-12-2005, 03:34 PM


    #2

    widemonk is offline


    Registered User


    you might need to explain a little more what you’re trying to acheive.

    There are two ways, either:

    =[formula]&»text»

    or

    =[formula]&D4 (where cell D4 contains the text you want adding to the end)


  3. 10-12-2005, 03:35 PM


    #3

    widemonk is offline


    Registered User


    … and brian is a guest so he wont see my reply


  4. 10-12-2005, 04:05 PM


    #4

    Re: Can you have a formula followed by text all in one cell?

    Hi Brian,

    =A1+B1&» Is the result of adding A1 & B1″


    Kind regards,

    Niek Otten

    «Brian» <Brian@discussions.microsoft.com> wrote in message
    news:9F7DC8A6-1A64-4FDE-8A53-FE416865327A@microsoft.com…


    > Just as the subject askes, I what to have a formula in a cell that the
    > number
    > that it puts out is then followed by whatever text i want. Is this
    > possible?


  5. 10-12-2005, 04:05 PM


    #5

    Re: Can you have a formula followed by text all in one cell?

    Brian, here is on way,

    =A1&» Your text here»

    Paul B
    Always backup your data before trying something new
    Please post any response to the newsgroups so others can benefit from it
    Feedback on answers is always appreciated!
    Using Excel 2002 & 2003

    «Brian» <Brian@discussions.microsoft.com> wrote in message
    news:9F7DC8A6-1A64-4FDE-8A53-FE416865327A@microsoft.com…


    > Just as the subject askes, I what to have a formula in a cell that the
    > number
    > that it puts out is then followed by whatever text i want. Is this
    > possible?


  6. 10-12-2005, 04:05 PM


    #6

    RE: Can you have a formula followed by text all in one cell?

    Yes.

    Select the cell with the formula in it and pull_down:
    Format > Cells… > Number > Custom
    the Type-in field will say General
    Your enter General» hello world»
    and you will see the result. If you do it this way you can still use the
    cell for math.

    Gary’s Student

    «Brian» wrote:


    > Just as the subject askes, I what to have a formula in a cell that the number
    > that it puts out is then followed by whatever text i want. Is this possible?


  7. 10-12-2005, 04:05 PM


    #7

    Re: Can you have a formula followed by text all in one cell?

    Hi!

    Try this:

    =your_formula_here&» your_text_here»

    Biff

    «Brian» <Brian@discussions.microsoft.com> wrote in message
    news:9F7DC8A6-1A64-4FDE-8A53-FE416865327A@microsoft.com…


    > Just as the subject askes, I what to have a formula in a cell that the
    > number
    > that it puts out is then followed by whatever text i want. Is this
    > possible?


Like this post? Please share to your friends:
  • Can you have microsoft word on ipad
  • Can you have microsoft word on a mac
  • Can you have excel on iphone
  • Can you have bullets in excel
  • Can you have a comma after the word and