**Please Note: **
This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), *this tip may not work for you*. For a version of this tip written specifically for later versions of Excel, click here: Matching Formatting when Concatenating.

When using a formula to merge the contents of multiple cells into one cell, Kris is having trouble getting Excel to preserve the formatting of the original cells. For example, assume that cells A1 and B1 contain 1 and 0.33, respectively. In cell C1, he enters the following formula:

=A1 & " : " & B1

The result in cell C1 looks like this:

1 : 0.3333333333

The reason that the resulting C1 doesn't match what is shown in B1 (0.33) is because the value in B1 isn't really 0.33. Internally, Excel maintains values to 15 digits, so that if cell B1 contains a formula such as =1/3, internally this is maintained as 0.33333333333333. What you see in cell B1, however, depends on how the cell is formatted. In this case, the formatting probably is set to display only two digits beyond the decimal point.

There are several ways you can get the desired results in cell C1, however. One method is to simply modify your formula a bit so that the values pulled from cells A1 and B1 are formatted. For instance, the following example uses the TEXT function to do the formatting:

=TEXT(A1,"0") & " : " & TEXT(B1,"0.00")

In this case, A1 is formatted to display only whole numbers and B1 is formatted to display only two decimal places.. You could also use the ROUND function to achieve a similar result:

=ROUND(A1,0) & " : " & ROUND(B1,2)

Another possible solution is to change how Excel deals with precision in the workbook. Follow these steps:

- Choose Options from the Tools menu. Excel displays the Options dialog box.
- Make sure the Calculation tab is displayed. (See Figure 1.)
- Ensure that the Precision As Displayed check box is selected.
- Click OK.

** Figure 1.** The Calculation tab of the Options dialog box.

Now, Excel uses the precision shown on the screen in all of its calculations and concatenations instead of doing calculations at the full 15-digit precision it normally maintains. While this approach may be acceptable for some users, for others it will present more problems than it solves. You will need to determine if you can live with the lower precision in order to get the output formatted the way you expect.

Still another approach is to create your own user-defined function that will return what is displayed for the target cell, rather than what is stored there. The following macro will work great in this regard:

Function FmtText(rng As Range) Application.Volatile FmtText = rng.Cells(1).Text End Function

To use this macro, you would use a formula like this in your worksheet:

=FmtText(A1) & " : " & FmtText(B1)

*Note:*

If you would like to know how to use the macros described on this page (or on any other page on the *ExcelTips* sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (3213) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: **Matching Formatting when Concatenating**.

**Save Time and Supercharge Excel!** Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out *Excel 2010 VBA and Macros* today!

When processing huge amounts of data, it can be a challenge to figure out how to derive the aggregate values you need. ...

Discover MoreYou could use Excel to collect data that is useful in your business. For instance, you might use it to collect ...

Discover MoreWith a long list of items in a worksheet, you may want to determine the last time a particular item appeared in the list. ...

Discover More**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

2021-04-10 09:50:41

Roy

Excel will not "bring along" formatting so when you build the output of a cell with a formula, the result will only have the formatting that cell (the cell you pout the formula in) began with.

So if the source is Bold, the Bold formatting will be left behind the cell your formula is in.

This is particularly vexing when you formatted individual characters inside the source cell.

But is is an absolute in Excel.

However, you CAN use VBA to accomplish whichever of the infinite variety of things you might want in your output. Just not formulas.

If your need is simple enough to make into rules, you might be able to, with a reasonable amount of effort, work out a Conditional Formatting rule, or set of rules, that can examine your input cell for certain formatting, and if it exists, apply it to your formula's cell. But... that would RAPIDLY become a HUGE task, impossible to scale up very much.

2019-08-24 17:12:10

JoseH

Hi. My name is JoseH.

There is a problem I have been looking a solution for with no results.

I hope you can help me out.

When concatenating texts I would like to keep the specific bold characters of all the selected cells.

I would like to get something like in the image:

(see Figure 1 below)

Best regards...

JoseH

**Figure 1.**

2018-02-08 14:17:01

jefada

Mine: =IF(ISBLANK(B17),"",(UPPER($B$5&"-"&$B$2&"."&TEXT($B$3,"00")&$B$4&"."&TEXT(C17,"0#")&"-"&(RIGHT(B17,4)))))

2016-09-09 05:58:47

Philippe

I'm not the kind of guy to leave a comment on a website, but I had to.

This may be the most useful yet simple macro I've ever used, it really is perfect.

Thanks for it!

Regards.

2016-06-09 16:03:08

Alan

The Format Text macro is a great, easy solution. Thanks Allen!

2015-06-24 09:39:42

IS IT POSSIBLE TO HAVE A BOX AROUND THE TEXT INSIDE THE CONCATENATE FORMULA IN EXCEL?

2015-06-09 19:09:24

John

2015-04-06 06:36:08

Barry

Use the formula:

=Text (A1, "dd/mm/yyyy") or use +text(A1, "d/m/yy") if you don't want leading zeroes on the days and moonths and a two-digit year.

the second parameter of the Text function can contain any of the formatting patterns found under the "format cells" dialogue or you can create your own. My favourite ofr date which avoids confusion with American style dates is "d-mmm-yyyy".

2015-03-03 14:03:31

Laura

Thanks so much, this was a big help in updating a price list.

2014-12-15 10:56:34

Craig Nordmark

Is there a way to do a concatenation if one of the values is a date and keep the date format?

Got a version of Excel that uses the
menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)?
**This site is for you!** If you
use a later version of Excel, visit
our *ExcelTips* site focusing on the ribbon interface.

**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

Copyright © 2022 Sharon Parq Associates, Inc.

## Comments