Display as percent in inline formula?

I’m dividing a currency by a currency in an inline formula to show a percentage change. The result appears as a currency. I can’t figure out how to reformat this to a percent. I’ve tried the format function but can only add a % but not remove the $.

Here is the formula I’m working with (StartPrice$ - EndPrice$)/(StartPrice$) which always returns a decimal $0.00.

1 Like

@Daniel_Helsten

Is the column formatted as a Percent column (from the dropdown menu in the column header)?

This is an inline formula. The two columns being used to make the percent change are currencies and are set as such in the table. The result isn’t in a table.

Gotcha, just reproduced your experience. I don’t know the answer, and defer to someone else.

Historically, formatting of numeric formula results on the canvas was not yet at parity with number formatting in cells (e.g., number of decimal places). This might be related to that.

You may be right. I may have to switch to just a number in the columns as a work around for now. Thanks.

1 Like

Did this ever get solved anywhere else?

Hi @nkim,
and welcome to Coda Community! :handshake:

I’m afraid that so far no explicit data types are defined for Named Formulas in canvas.
You can rely on formatting the outcome through string manipulation.

Therefore - in this case - it could be:
Format("{1}%",100 * ((StartPrice$ - EndPrice$)/(StartPrice$))

I hope this helps.

6 Likes

This helps! Any ideas for reducing the number of decimal points using that string manipulation?

Don’t need to see 8.333333333333334%

1 Like

@nkim : Round() (or : RoundDown(), RoundTo(), RoundDown()) and a .ToText() to convert the percent should do the work :blush:.

Format("{1}%",Round(100 * ((StartPrice$ - EndPrice$)/(StartPrice$)),2).ToText())
1 Like

As @Pch suggested, Round() (or any of its variations) will do the trick.
You can omit the ToText() as it’s implicit.

Arf :sweat_smile: ! Thanks for the correction @Federico_Stefanato :wink: !
I probably was distracted :sweat_smile:

1 Like

Simple and useful, thank you.