• Resolved Michael

    (@taloscent)


    =[tuitionrate]*6.00
    I have this code that takes the value of a shortcode, which is 2.00, and multiplies it and displays a result of 12.

    =${NUMBER_FORMAT(SUM(B3:B4), 2 )}
    I have this code which displays the results with the dollar sign and two decimal places.

    How can I combine this so that the first formula also displays a $ and two decimal places?

    https://ww.wp.xz.cn/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    That should be something like this:

    =${NUMBER_FORMAT( [tuitionrate]*6.00 , 2 )}

    (You will also need to have the Shortcodes before formulas Extension activated, but you should already have that.)

    Regards,
    Tobias

    Thread Starter Michael

    (@taloscent)

    I have each of the following lines in each their own cells:
    [registrationfee]
    180.00
    =[tuitionrate]*6.00
    =${SUM(B1:B3)}

    If I change line 3 to =${NUMBER_FORMAT( [tuitionrate]*6.00 , 2 )} then line 4 complains “!ERROR! B3 does not contain a number or expression”

    So can I not use this solution in another formula to total the columns?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    the reason for this is that the result (something like $123.00 is not a number, but a string.
    I therefore suggest to main an extra column, where you only do the numeric calculations, but which you hide from the user.
    So, one column (column A in my example) would be

    [registrationfee]
    180.00
    =[tuitionrate]*6.00
    =SUM(B1:B3)

    and the column on the right to that one would be

    =${NUMBER_FORMAT( A1, 2 )}
    =${NUMBER_FORMAT( A2, 2 )}
    =${NUMBER_FORMAT( A3, 2 )}
    =${NUMBER_FORMAT( A4, 2 )}

    With this, you are basically splitting the calculations and the display parts.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘$ and decimal places’ is closed to new replies.