Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

formatting number within a calc

Featured Replies

Hi guys,

I understand how to format a number field. What my problem is when i then include it in a calc it seems to be dropping a lot of the formatting. An example follows

field: LoanAmt

number entry: 5200

formatted entry: 5,200.00

in my calc i have:

If(Loan = "Yes", "This contract is subject to finance in the amount of $" & NumToText(LoanAmt) & " from " & LoanLender & " approval of which is due by " & DateToText (LoanAppDueDate), "") & If(SpecialConditions <> "", "" & SpecialConditions, "")

My problem is when the number is a .00 it just puts in the number with no decimal or thousands separator. i.e 2.56 works fine. 2.00 does not and only puts in 2, likewise 5000.56 but it should be 5,000.56

Even if i type in the comma and the decimal it ignores it in the calc. The other thing i guess is to change the number field to a text field ... and that will work fine in the calc, but it wont' format the field if the user types it in as 5000

Why don't you display the field as a merge field and use the number formatting options to show 2 decimal places and the thousands separator?

  • Author

I can't do that because i need to export the result externally as one field

Ah, yes. I remember it well.

Make it stop! Make it stop! Dear God, please MAKE IT STOP!

crazy.gif

Hi Queue,

Some things are just to "interesting" to die a natural death.

grin.gif

I was afraid of that too Bob, and I'm not sure it may be easy here too as he wants the "," to separate thousands...

Let see if this would work :

Case(TextToNum(NumberText)>1000,

Left(NumberText,Length(Int(NumberText / 1000))) & "," & Middle(Int(Round(ABS(NumberText), 2)),Length(Int(NumberText / 1000))+1,14) & "."& FIN(100+MOD(Round(ABS(NumberText)*100,0),100),2),Int(Round(ABS(NumberText), 2))& "."& FIN(100+MOD(Round(ABS(NumberText)*100,0),100),2))

So that 152489.896 ==> 152,489.90

Largely isnpired by the thread you mentionned, that had ruined my week-end grin.gif

Please all, say it again...STOP. tongue.gif

I thought somewhere near the end of the thread, Dj had posted a method that handled the thousand separator. Does this mean I have to go back and read the whole thing over again? Aaaaaahhh!

This is a bit simpler but only works with non-negative numbers:

Case( Int(NumberEntry/1000), Int(NumberEntry/1000)&","&Right("000"&Mod( Int(NumberEntry),1000),3),Mod( Int(NumberEntry),1000) ) & "." &

Right("00"&Round((NumberEntry-Int(NumberEntry))*100,0),2)

Also, it only puts in one comma. If the number is bigger than 999,999.99, then the formula needs to be modified to add another comma.

Here we go again.

Somewhere near the end ?

You mean the 4th page I had never read before...

These ^ just make me sick

Case(TextToNum(NumberText)>1000,

Left(NumberText,Length(Int(NumberText / 1000))) & "," & Middle(Int(Round(ABS(NumberText), 2)),Length(Int(NumberText / 1000))+1,14) & "."& Right(100+MOD(Round(ABS(NumberText)*100,0),100),2),Int(Round(ABS(NumberText), 2))& "."& Right(100+MOD(Round(ABS(NumberText)*100,0),100),2))

just replaced the "FIN" which is Right() in French

  • Author

oh no did i open up a can of whoop ass.. lol grin.gif

Thanks guys i'll read up when I get back to work in the morning. Such a simple thing really you'd think fmp would deal with it...

The secret to finding stuff on this forum is knowing the keywords to search for!

At the very end of that thread, Dj did post a method that handles the commas.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.