Variable Decimal Format

Feb 21, 2009

Cell C9: 1.25773
Cell C10: 20.0
Cell C11: 2.25%
Cell C15: =C9+((C10*C11)/10000)

C9 is a user entered value, currently formated general
C10 is a user entered value, currently formated decimal with one decimal
C11 is a user entered percentage, currently formated percent with two decimals
C15 is a formula calculation, currently formated general

I've tried formating cells to general (and/or) text and the values appear to be correct but still don't show what I want.

The most popular entries for C9 will be:
123.12
123.123
1.1234
1.12345
Any of the above could have one or more trailing zeros.

I would like C15 to show the same amount of decimal places that the user enters in C9. If user enters one, two, three, four, five, etc...decimal places in C9 then show the same amount of decimal places in C15 after the calculation is done and include any trailing 0's that are needed to match the number of decimals in C9.

I've tried different If statements with custom format to try to get the format of C9 transfered to C15 but haven't come across the right way to do this.

View 14 Replies


ADVERTISEMENT

Convert Or Format Decimal To X Digits Without Decimal Point

Aug 8, 2008

I am trying to create a unique sample code by putting together the values of other cells that a user will input. It's all working well apart from the last part, where I am trying to include a decimal number. I want the decimal number to appear without the central "." and in a four digit format. e.g. 2.5 would appear as 0250, 14.25 would appear as 1425. This is the formlua I am using currently:

=IF(ISBLANK(B4),"",IF(LEFT(C4,1)="w",(B4&"-"&TEXT(F4,"YYMMDD")&C4&TEXT(G4,"HHMM")),(B4&"-"&TEXT(F4,"YYMMDD")&C4&LEFT(TEXT(H4,"00"),2)&RIGHT(TEXT(H4,"00"),2))))

However, where the value of H4 is 2.5, I am getting a result of 0303 (I've put this part in bold). I have attached a small spreadsheet to aid understanding.

View 2 Replies View Related

Convert Cells With Percentage Format To 'same' Decimal In A Column With Mixed Format

Jun 7, 2006

I have a column of cells with values - 0.2%, 0.32%, 0.22, 0.5 etc. The cells with % symbol are in ' Percentage, 2 decimal' format while the plain numbers are in 'General' format i.e. column contains cells in either of these formats. I need a macro where I can specify the column and it will select the cells with the % format, convert it to 'General' and multiply the result by 100 eg. 0.2% converted to 'General' becomes 0.002. When multiplied by 100, result is 0.2 i.e. is displayed without the % symbol.

View 7 Replies View Related

Declaring A Variable As A Decimal

May 2, 2008

Using excel 2003

What is the proper declaration for a decimal, I’ve been using currency because it has two decimal points i.e.

Dim x as Currency ...

View 9 Replies View Related

Compare Variable To Decimal Numbers

Sep 28, 2007

I have an If loop which looks like: If x < 54.5 And x > 52 Then

I have declared x as "Long", but still when it does the comparison it seems to round x up to the nearest whole number for the second comparison ( x > 52 ).

View 4 Replies View Related

Pass Decimal To Variable & Then To Cell

Jun 3, 2008

Why when I want to use a varaible with a value like that 2.1, 0.9, 3.5 in a code to create a formula gives me an error? How to get it work?

Sub Code1()
Dim k As Double
k = 2.1
Range("h11").Formula = "=" & k
End Sub

Strange, but it works well if k is an integer with no Decimal Fraction, like 1, 2, 5, 11 ..

View 4 Replies View Related

Removing Variable Amount Of Decimal Places

Jul 2, 2013

I have a list with a variety of numbers:

a) some with large units (never more than 10 units long) and possibly also decimals,
b) others with minimal units but long decimal characters,
c) and others containing both.

I need a formula that can be applied to each individual number, that removes a variable amount of decimal places, resulting in a maximum character length of 14 (i.e. sometimes removing a few decimal places, other times removing a substantial amount of decimal places). Removed decimals are displayed in red in the following example

a) 1234567890.123456789
b) 1.2345678901234567
c) 123456.789012345678901234567890

View 6 Replies View Related

Text Function - Variable Decimal Separator

Sep 13, 2013

I have a workbook that is being used by users with both "," and "." as decimal separator. This is working all fine, except for one cell, where I need the number output to be displayed with two decimals. See formula below:

="Open at " & TEXT(+OHL!J$13+OHL!H$15,"0.00") & " and Go"

This example does not work with "," decimal settings.

Is there any different way to force two decimals in a text string, except for TEXT (where the format given in itself limits the cross decimal separator functionality)?

View 3 Replies View Related

Variable Type Changing Number Of Decimal Places

May 14, 2014

Here's what I'm doing: I'm using a macro to assign a cell value to a variable then set another cell value to the variable instead of copy/paste (because even pasting values only was affecting other formulas in the file for some reason)

The problem: in using the macro, the number being 'copied' is acquiring a few extra decimal places IE 38334.61 is the original number and 38334.609375 is what I end up with. The numbers come from a CSV with only 2 decimal places and I checked by adding decimal places in the format so it's not a formatting/visible digits issue. Since the values are hour meter readings, the extra decimal places end up with very small values outside 0-24 hrs which messes with sorting and usage %. The values are so small all of them together in a month add up to a fraction of a cent but it's one of those things that bugs my OCD by not being right.

My VBA book explains the min/max capabilities, content type, memory bits but not fiddly details like this.

So my question is this: right now I'm declaring the clipboard-substitue variable as an single, is there a different one that would work better without adding anything? Criteria are: numeric, 6 digits before the decimal, 2 after, all positive values. (Ie 123456.12)

EDIT: fixed my senior moment.

View 6 Replies View Related

Convert Decimal To 00:00:00 Time Format

Apr 9, 2014

How to be able to convert decimal hours into time format.

Here are the examples:

12.2 = 12:02:00
98.41 = 98:41:00
300.42.1 = 300:42:10

and so on and so forth...

View 11 Replies View Related

How To Format A Number Into 2 Decimal Places

Jun 5, 2014

Is there a way to format a number into 2 decimal places and when you select the cell you wont see the true value?

For example:

316.2696

I still see the 316.2696 when I click the cell. Instead of 316.27 only.

View 4 Replies View Related

Automatic Decimal Format Control

Sep 30, 2008

I need to control the amount of decimals allowed by the entry of another column same row so I do not have to format the cells everytime to get the correct decimal places. I need all my data in one table so I can do pivot tables.

View 14 Replies View Related

Change The Format So That There Are No Digits After The Decimal

Nov 10, 2008

If I enter 2.5 into a cell, and then change the format so that there are no digits after the decimal, the number changes to a 3.

2.4 correctly rounds to 2, but shouldn't 2.5 round to 2???

I thought that even numbers were supposed to round down, and odd numbers round up when there is a 5 right after the decimal.

View 3 Replies View Related

Using The Accounting Format With No Decimal Places

Jan 15, 2009

I am using Excel 2003. I am attempting to use the Accounting format with numbers that should not have any decimal places (although what is entered might have a decimal place). The numbers line up fine on the right, however, the dollar signs on the left are not lining up. It looks something like:

View 4 Replies View Related

Time Appears In Decimal Format?

Nov 16, 2011

I trying to create a schedule on my 2002 excel. I placed all the times in HH:MM AM/PM format. But somehow...I don't know what I was doing...all the times instantly appear as decimals on the cells. The times I inputted still appears in the cell's formula bar. I tried changing the cell's format to my prefferred time format, but the cells wouldn't budge.

View 4 Replies View Related

Currency Format With 4 Decimal Places

Dec 10, 2008

I have a problem with the currency format with 4 decimal places.

Sub go()
Range("C5") = Range("C5") + Range("C4")
End Sub
as you can see it adds the conecnt of "R4" to what is in "R5"

If works fine when the calls are formatted as number with 4 decimal places.
example if R4 is 0.1111 and R5 is 0.2222 after running the macro R5 becomes 0.3333

But if the cells are formatted as currency and 4 decimal places the then excel returns $0.3300

View 9 Replies View Related

Decimal Format With No Trailing Zeros

Jan 13, 2009

I need to never have a trailing zero be displayed but still have decimals displayed (we can use up to 3 digits for the example) Here's a list of test cases

Value______Display
1.234567___1.235
1.234______1.234
1.23_______1.23
1.230______1.23
1.2________1.2
1.200______1.2
1.0________1
1.000______1
1.020______1.02
1.0002_____1
0__________0
0.001______0.001
0.0001_____0

The only time I want to see a 0 is when the answer is 0 (or rounded to 0) or when 0 is required in the middle. This is for patient safety if you are curious. 2.0 when printed out or written by hand can be mistakenly read as "20" in the heat of things, thus 2.0 should be written/printed as "2" (no decimal on the end) not as "2." even, just "2"

View 6 Replies View Related

Format Number Of Decimal Places To Show

Mar 24, 2009

Is there a way to format a cell based upon a condition? If the cell value is <1, I want to show two decimal places. If the cell is >1, I want to show zero decimal places. I tried to use the conditional formatting, but there is no option for this.

View 3 Replies View Related

Display Decimal Value Input As String Format

Aug 16, 2012

I'm writing a macro that will automatically change the display in a column of cells.

The input in the cell would be a decimal value, (e.g. 1, 1.25, 1.5, 1.75, 2). As of now, I think the only input options are whole numbers and 1/4, 1/2, 3/4 fractions.

After inputting the decimal value, the cell should update to display the value as the following string format :

Input: 1.25
Displays: 1-1/4"

The purpose being to enable fast data entry while displaying in the desired format.

Here is where I know to begin for the automatic update:

Code:

Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'
'
'Code
'
'
Application.EnableEvents = True
End Sub

View 6 Replies View Related

UserForm - Format Textbox For Percentage Vs Decimal?

Dec 20, 2012

I have the following code

Code:
Private Sub ComboBox1_Change()
TextBox1.Text = Range("P" & UserForm1.ComboBox1.ListIndex + 3).Value
TextBox2.Text = Range("N" & UserForm1.ComboBox1.ListIndex + 3).Value[code].....

In TextBox3, the user will input a percentage as a whole number, IE: 5 for 5%, but when the update is made, it is writing the "5" as 500% and is writing 50 as 5000%.

If there is already a percent in the cell it calls up IE: 50%, it shows up in TextBox3 as .5%

View 1 Replies View Related

How To Convert Big Hexadecimal Numbers To Decimal Format

Mar 19, 2013

I need to be able to convert big hex numbers into decimal numbers. The problem that I have with this is that when you put a hex number that includes letters excel considers it text. And if the number is too big, you can't convert it to decimal format, and when you try to, it comes up with the #NUM! error.

Number: "78652385098375A879FF747C9847A00" without quotes

View 4 Replies View Related

Total Experience In Decimal Format Calculation

Jul 20, 2013

I have employee experience data in decimal format in different columns like 4 years 6 months = 4.6

Is there a way to Sum the Values of cells so that it gives total experience in decimal format as same??

A1

B1
TOTAL EXPERIENCE (EXPECTED TOTAL SUM)

4.6

4.6
9.0

5.5

5.5
10.10

2.11

2.11
5.10

View 1 Replies View Related

Format To Bring Decimal Point Forward

Aug 22, 2008

Is there anyway to be able to bring decimal point forward without affecting the numbers using any formatting, which will still be there even after refreshing the query.

For example, 0.0531 to 53.1

View 9 Replies View Related

Number Format: Change Decimal To Comma

Nov 1, 2006

Is there any way to change the decimal point from the usual period symbol (.) to a comma (,). The reason being, i have a structural design spreadsheet and the new terminology is just so, changed from 00.00 to 00,00 I have tried cell formatting but it just uses a comma (,) for numbers in their thousand and it wont do what i need.

View 3 Replies View Related

Custom Format To Replace Decimal With Comma

Mar 21, 2008

I am having problems applying custom format to numbers that need to be formatted.
custom format use is 0",00". When I apply the custom format above to whole numbers, I achieve the results I want:

0.00
20.00
40.00

becomes

0,00
20,00
40,00

However, when I apply to numbers with decimal places

0.20.......

how I can change the custom format so that the period is replaced with a comma but the decimal values are preserved?

View 4 Replies View Related

Format All Percentage Cells To X Decimal Places

May 17, 2008

I would like to do the following: * Format numeric cells (cells with a percent sign) to zero decimal places. I have a set of macros that I am combining to clean up a data set and these are two of many (removing blank lines, duplicates, blue/bold, etc.)

View 2 Replies View Related

Convert Decimal Numbers (Minutes) To Time Format

Mar 8, 2013

How to convert decimal numbers which represent minutes into time format? Like this

Sheet3  GH1MinutesTime212.9729729700:13:00325.9459459500:26:004116.756756801:57:00

View 2 Replies View Related

Excel - XML Number Format (All Data To Come In With One Decimal Place)

Sep 23, 2013

I am trying to export a range of data from excel to xml. I have a module that puts the range of data into one cell:

Code:

Function Concat(myRng As Range)
Dim myStr As String
Dim c As Range
myStr = ""
For Each c In myRng
If c.Value "" Then myStr = myStr & ", " & Chr(34) & c.Value & Chr(34)
Next
Concat = Mid(myStr, 2, 9999)
End Function

How to all data to come in with one decimal place (eg. "4.5","5.0",7.0")

Right now it looks like this:

("4.5","5",7")

View 3 Replies View Related

Format Cell With Concatenated Contents To 2 Decimal Places

Dec 3, 2013

I have a list of cells that has two values concatenated. The first I would like to round to 2 decimal places, and the second is always a integer

Consider this formula..

Code:
=IF(SUMIFS('Analysis Data'!$I$5:$I$1840,'Analysis Data'!$C$5:$C$1840,3,'Analysis Data'!$E$5:$E$1840,1)=0,0,SUMIFS('Analysis Data'!$I$5:$I$1840,'Analysis Data'!$C$5:$C$1840,3,'Analysis Data'!$E$5:$E$1840,1)/COUNTIFS('Analysis Data'!$C$5:$C$1840,3,'Analysis Data'!$E$5:$E$1840,1,'Analysis Data'!$I$5:$I$1840,">0"))
&"("&COUNTIFS('Analysis Data'!$C$5:$C$1840,3,'Analysis Data'!$E$5:$E$1840,1,'Analysis Data'!$I$5:$I$1840,">0")&")"

In one cell this yields the value;

2.42553191489362(47)

In another it yields 2.975(40)

and so on..

I would like to format it to display as 2.43(47) and 2.98(40)

FWIW this means average of 2.43 games refereed per session in 47 sessions of refereeing.

View 3 Replies View Related

Format Result Of Date Difference To 2 Decimal Places

Apr 27, 2007

I use datediff to calculate the difference between 2 dates in Months.

Result = Datediff("M", Date1,Date2)

I need the result to be formatted to 2 decimal places ie 23.52 (months)

Not neccessary to use datediff if this doesnt work.

Please note I have cross posted this HERE because I couldnt get connected to ozgrid for some reason, I will montior both sites for a solution and post back results. Apologies for the inconvenience.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved