Price Data Formatting



Hello.

I've created what I consider some pretty novice ways to format my price
data.

But I can't help thinking there is a better way to do this.

For example, suppose I am loading price data that appears to be a decimal
and 4 digits like this (.1234).

The program would need to determine that all results produced from these
values must also have 4 digits after the decimal, even if the answer is just
..123 or 23.

The .123 should then display as .1230 and the 23 should display as 23.0000,
both cases where 4 digit places exist in the display following the decimal
only because the data loaded appears to be in that form.

I might load data that looks like this:

3.4567
2.3482
5.2849
6.123
1.3847


This tells me that the format I want is a digit prior to the decimal and 4
digits following, even though some of the data loaded actualy had only 3
digits following the decimal. The maximum format from the sample is 1.1234
format. Therefore, I want to format all my resulting calculations in the
same 1.1234 format. Of course the result can be greater than 1 digit left of
the decimal, but not greater than 4 following in this case.

If my sample data is:

23.45
83.83
22.2
48.89

This tells me I need to format 2 places following the decimal and AT LEAST 2
prior.

What I have been doing now is loading the data and noting the maximum digits
found right of the decimal and left of the decimal.

How I do this is through a LOOP, using INSTR to find where in the price
string the decimal is located, and using the LEN. But then I have to figure
out how to make the changes in the Format() to display all my data in that
format discovered, so I create a few Format()'s with "0.0", "0.00", "0.000",
"#.0000", etc. etc.

This seems pretty hookie to me.

Any suggestions on a better way to do this?

Thanks.

Webbiz








.



Relevant Pages

  • Re: Price Data Formatting
    ... I have not check t see if the Format ... I've created what I consider some pretty novice ways to format my price ... and 4 digits like this. ... string the decimal is located, ...
    (microsoft.public.vb.general.discussion)
  • Re: Custom date format not working in ACC2003
    ... It forces the year to display as 4 digits in dates, ... setting the Format of the control won't rescue it. ... the date fields in reports always format ...
    (microsoft.public.access.reports)
  • Re: Price Data Formatting
    ... I'm loading into the application price data that has a format I do not know ... Since price data format is all dependent on the market selected (say IBM ... rounded/truncated to 2 digits following the decimal as well. ... Dim sStr As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Format Problem
    ... I set the numberformat property to General and it still does ... for the long date format. ... for the month and date separator, and displays two digits for the year. ... Currency Displays a number according to the Windows regional ...
    (microsoft.public.excel.programming)
  • Re: Text formatted cells displaying numbers in scientific format
    ... It is just Excel trying to be helpful. ... When it 'sees' a large number it uses scientific format since ... I accept that Excel can't handle numbers greater than 15 digits and your ... string was 16 digits or more to be converted to a scientific value. ...
    (microsoft.public.excel)