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.

Number Notation

Featured Replies

Is there a calculation or custom function that can accomplish the following number notation?

1                    -->    $1
10                  -->    $10
100                -->    $100
1000              -->    $1K
10000            -->    $10K
100000          -->    $100K
1000000        -->    $1M
10000000      -->    $10M
100000000    -->    $100M

Thank you

Anthony

This can be parsed with a calculation.  A few questions about what you expect to see for results. Are these the only results?

1                    -->    $1
10                  -->    $10
100                -->    $100
1000              -->    $1K
10000            -->    $10K
100000          -->    $100K
1000000        -->    $1M
10000000      -->    $10M
100000000    -->    $100M

or will you have numbers like 295899?  If so , do you want those numbers rounded up-295K or 296K?

Hi Anthony and welcome to the FM Forum,

 

1 hour ago, AnthonyDixon said:

Is there a calculation or custom function that can accomplish the following number notation?

 

Here are a couple of cf’s that may work for you, however, I’m not sure what you are really trying to accomplish.

http://www.briandunning.com/cf/244

http://www.briandunning.com/cf/393

 

  • Author
1 hour ago, Steve Martino said:

This can be parsed with a calculation.  A few questions about what you expect to see for results. Are these the only results?

1                    -->    $1
10                  -->    $10
100                -->    $100
1000              -->    $1K
10000            -->    $10K
100000          -->    $100K
1000000        -->    $1M
10000000      -->    $10M
100000000    -->    $100M

or will you have numbers like 295899?  If so , do you want those numbers rounded up-295K or 296K?

Yes, having the numbers rounded up would be great.

It seems to me that there are two parts to this question:

  1. How to round the number to the nearest (?) power of 10;
  2. How to format the result as units, thousands or millions.

Note that I am perforce guessing about the first part, since you only gave examples of rounded numbers and did not explain the underlying logic.

Try the following calculation =

Let ( [
magnitude = Case ( number = 0 ; 0 ; Floor ( Log ( Abs ( number ) ) ) ) ;
r = Round ( number ; -magnitude ) 
] ;
Case (
r ≥ 10^6 ; Div ( r ; 10^6 ) & "M" ;
r ≥ 10^3 ; Div ( r ; 10^3 ) & "K" ;
r )
)

The result, of course, must be Text.

Edited by comment

  • Author
2 hours ago, comment said:

It seems to me that there are two parts to this question:

  1. How to round the number to the nearest (?) power of 10;
  2. How to format the result as units, thousands or millions.

Note that I am perforce guessing about the first part, since you only gave examples of rounded numbers and did not explain the underlying logic.

Try the following calculation =


Let ( [
magnitude = Case ( number = 0 ; 0 ; Floor ( Log ( Abs ( number ) ) ) ) ;
r = Round ( number ; -magnitude ) 
] ;
Case (
r ≥ 10^6 ; Div ( r ; 10^6 ) & "M" ;
r ≥ 10^3 ; Div ( r ; 10^3 ) & "K" ;
r )
)

The result, of course, must be Text.

Thank you so much for your help. Just what I was looking for. Originally I was just
looking for the notation for any number that fell into that range but your suggestion
of rounding up makes for a much better result for what I was trying to accomplish.

Thanks again
Anthony

 

5 minutes ago, AnthonyDixon said:

your suggestion of rounding up makes for a much better result

Please note that contrary to the suggestion made by @Steve Martino, I am not rounding up, but to the nearest boundary.

For example, 949 is rounded down to "900", while 950 will be rounded up to "1K" - keeping with the most common rounding method of "round half up".

  • Author
11 hours ago, comment said:

Please note that contrary to the suggestion made by @Steve Martino, I am not rounding up, but to the nearest boundary.

For example, 949 is rounded down to "900", while 950 will be rounded up to "1K" - keeping with the most common rounding method of "round half up".

Yes this is perfect, Thank you again.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.