The DOLLAR function in Excel is a text function that converts a numeric value to a text string in a currency format. The syntax of the function is:
=DOLLAR(number, decimals)
where number
is the numeric value to be converted, and decimals
is the number of digits to display after the decimal point. If decimals
is omitted, it defaults to 2.
The DOLLAR function returns a text string that starts with a dollar sign ($) and uses a comma (,) as the thousands separator. The decimal point is a period (.). For example:
=DOLLAR(1234.56) returns "$1,234.56"
=DOLLAR(-12.345, 1) returns "($12.3)"
=DOLLAR(0.123, 3) returns "$0.123"
Note that the DOLLAR function does not affect the actual value of the number, only its display format. To perform calculations with the converted text, you need to use the VALUE function to convert it back to a number.
Scenario
Suppose you have a list of sales amounts in column A, and you want to display them in a currency format in column B. You can use the DOLLAR function to do this. Here are the steps:
- In cell B2, enter the formula
=DOLLAR(A2)
. This will convert the value in A2 to a text string in a currency format. - Drag the fill handle down to copy the formula to the rest of the cells in column B. This will apply the DOLLAR function to each value in column A.
- You can adjust the number of decimals to display by adding a second argument to the DOLLAR function. For example, if you want to display only one decimal place, you can use
=DOLLAR(A2, 1)
. - You can also format the cells in column B as text, so that Excel does not try to interpret the text strings as numbers. To do this, select the cells in column B, right-click, and choose Format Cells. Then, under the Number tab, choose Text as the category.
Here is an example of how the worksheet looks after applying the DOLLAR function:
Sales Amount | Currency Format |
---|---|
1000 | $1,000.00 |
2500.5 | $2,500.50 |
500.25 | $500.25 |
750.75 | $750.75 |
1250.1 | $1,250.10 |
Other approaches to convert numbers to currency in text format
The DOLLAR function is one way to convert numbers to currency in text format, but it is not the only way. Here are some other approaches you can use:
- You can use the TEXT function, which allows you to specify any custom format for the text string. For example,
=TEXT(A2, "$#,##0.00")
will produce the same result as=DOLLAR(A2)
. - You can use the CONCATENATE function, which allows you to join text strings together. For example,
=CONCATENATE("$", A2)
will add a dollar sign to the beginning of the value in A2. However, this will not add commas or decimals, so you may need to use other functions to format the number first. - You can use the FORMAT function, which is a macro function that applies a format to a value and returns it as a text string. For example,
=FORMAT(A2, "Currency")
will apply the currency format to the value in A2 and return it as a text string. However, this function is not available in all versions of Excel, and it may require you to enable macros in your workbook.