473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Format number as 0.0k

Is it possible to setup a number format in a query to display result
as

x.xK (4.0K instead of 4000)

I am trying to abbreviate the numbers contained in graphs which are
not displaying correctly due to too many values on the x axis. I
would prefer to not to use an "iif" formula but utilise the "format"
function.

The following format works for excel, but is not compatible with
access:
[<1000000]$###.0,K;$###.0,,\M

Hope someone can help.
Nov 13 '05 #1
5 5608
Nathan Bloomfield wrote:
Is it possible to setup a number format in a query to display result
as

x.xK (4.0K instead of 4000)

I am trying to abbreviate the numbers contained in graphs which are
not displaying correctly due to too many values on the x axis. I
would prefer to not to use an "iif" formula but utilise the "format"
function.

The following format works for excel, but is not compatible with
access:
[<1000000]$###.0,K;$###.0,,\M

Hope someone can help.


lngNum = 10000000.5
? format(lngNum,"00.0K")
10000000.5K
Nov 13 '05 #2
On Mon, 20 Dec 2004 06:56:58 GMT, Salad <oi*@vinegar.com> wrote:
Nathan Bloomfield wrote:
Is it possible to setup a number format in a query to display result
as

x.xK (4.0K instead of 4000)

I am trying to abbreviate the numbers contained in graphs which are
not displaying correctly due to too many values on the x axis. I
would prefer to not to use an "iif" formula but utilise the "format"
function.

The following format works for excel, but is not compatible with
access:
[<1000000]$###.0,K;$###.0,,\M

Hope someone can help.


lngNum = 10000000.5
? format(lngNum,"00.0K")
10000000.5K


I believe he wanted it to format a number in terms of its value in K=1000, so
for 10000000.5, he wants the format to be 10000.0005K
Nov 13 '05 #3
That is correct, Steve.

I would like to abbreviate the numbers in the format "0.0k"

e.g. 5000 would be 5k, 10,500 would be 10.5k
I have yet to find a solution. Any help will be much appreciated.

Nov 13 '05 #4
<na**************@hotmail.com> wrote
That is correct, Steve.

I would like to abbreviate the numbers in the format "0.0k"

e.g. 5000 would be 5k, 10,500 would be 10.5k
I have yet to find a solution. Any help will be much appreciated.


Could you use two fields, one for the actual value:
n=5500

the other just for the label

Format(n/1000,"00.0k")

?

Darryl Kerkeslager
Nov 13 '05 #5
na**************@hotmail.com wrote:
That is correct, Steve.

I would like to abbreviate the numbers in the format "0.0k"

e.g. 5000 would be 5k, 10,500 would be 10.5k
I have yet to find a solution. Any help will be much appreciated.


Function KFormat(pvarNumber As Variant) As Variant
Dim curNumber As Currency

If IsNull(pvarNumber) Then
' GIGO factor :-)
KFormat = Null
Else
If IsNumeric(pvarNumber) Then
curNumber = pvarNumber
If Int(curNumber) = curNumber Then
' Integer
KFormat = Format(curNumber, "#,##0\k")
Else
KFormat = Format(curNumber, "#,##0.0###\k")
End If
Else
' More GIGO factor.
' what do you want to do here?
' Return a null?
' Return an error message?
' Raise an Error?
' Emulate Access?
KFormat = "#num?"
End If
End If
End Function
--
This sig left intentionally blank
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: martin.mrazek | last post by:
Hello, I wanted to install Number::Format module bud ended up with following error message. Does anybody have any suggestion what the cause could be?? Could that be due to presence of perldl in my...
3
by: stevek | last post by:
How do I format an integer. Add commas. 1234565 1,234,565 TIA
1
by: renee_ld | last post by:
In a query I used the function datediff to calculate the number of minutes between two time periods on a given day. This function returned the number of minutes as a long integer data type. I...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
11
by: Grumble | last post by:
Hello, I have the following structure: struct foo { char *format; /* format string to be used with printf() */ int nparm; /* number of %d specifiers in the format string */ /* 0 <= nparm <=...
11
by: shsandeep | last post by:
I used the following query to retrieve the date in dd-mon-yyyy format. db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' || RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' ||...
6
by: JFB | last post by:
Hi all, How can I format a fax number as 888-333-444? The number is coming from database as 8883334444 <ItemTemplate> <%#container.dataItem("cfax")%> </ItemTemplate> Tks JFB
7
by: Michael Howes | last post by:
MSDN documentation for format strings seems ambiguous. It's says things like "significant digits or number of decimal places" all over the place. Well those two things are different. How do I...
10
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I...
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.