下面的JSFiddle中的JS函数返回($6.48),但是在chrome中使用时返回-$6.48
function formatCurrency(value) {
var neg = false;
value = parseFloat(value, 10).toFixed(2);
if (value < 0) {
neg = true;
total = Math.abs(value);
}
value = value.replace(/(\d)(?=(\d{3})+\.)/g, "$1,").
以下所有内容都发生在If语句中
我有一个变量,差,这是减去两个货币值的结果。
然后我有另一个变量,Message,如下所示:
If AssessedValue < ProposedValue Then
Difference = Format(ProposedValue - AssessedValue, "Currency")
Message = "Average value is " & Difference & " more than the current
apprais
我的Chart.js图表的Y轴上的标签前面应该有一个美元符号,因为它们是货币的价值。
这段代码在文档中,但对我不起作用。
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
yAxes: [{
ticks: {
// Include a dollar sign in the ticks
callback:
我有一个Access应用程序,它使用来自MySQL数据库的数据自动生成Excel报表。
到目前为止,在特定列中输入的数据被错误地自动格式化。
在另一篇专栏文章中,我也遇到了同样的问题,其中的货币是自动格式化的,并使用.Format而不是.NumberFormat解决了这个问题,这是基于本文在堆栈溢出中发布的类似问题中提出的解决方案。
更具体地说,我使用了以下代码:
Range("G1", AmountLastCell).Select
For Each c In Selection
c = Format(c, "Currency")