Include text in formulas
We often hear that you want to make data easier to understand by including text in your formulas. For example, you might want to add text to call out how many units someone sold. You can do that by including text in your formula that's surrounded with double quotes ("). All characters (including numbers, spaces, and punctuation) between the double quotes will be shown as text in the formula result.
Here's an example of a simple formula that includes text:
=A2&" sold "&B2&" units."
If 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. Note that the double quotes don't surround cell references like A2 and B2. They're only used around the text that comes before and after any cell references in the formula.
Include text in a formula that uses a function
This example uses the TEXT and TODAY functions to create a phrase such as Today is Friday, January 20.
="Today is " & TEXT(TODAY(),"dddd, mmmm dd.")
The TODAY function calculates the current date, and the TEXT function applies the dddd, mmmm dd date format to show that date as Friday, January 20 in the resulting text string.
Note how the date format ddd, mmmm dd is surrounded by double-quotes and 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 & to combine the words Today is, followed by a space, with the formatted date.
No comments:
Post a Comment