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)?
I have made some macros for importing data from a txt fileand to sort the data into a sheet ready to be exported into another txt file. I have made VBA to work with "." as decimal separtor within the spreadsheet.
But, when I run the macro to export the data into a txt file (I have used the macros from this site [URL] .....) it automatically changes all "." into ","
But why?!?
I need the txt file to load data into another program, and this program need the use of "." as decimal separator - and not ",".
Function VLOOKUPRow() Dim SV As Object Worksheets("Midterm").Select SV = "UserFormAppend.TextBoxInvID.Text" VRow = Columns(1). Find(What:="SV", After:= Cells(1, 1), _ LookIn:=xlValues, SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, MatchCase:=True).Row MsgBox (VRow) End Function
I am trying to give the VRow variable the value or the row that The text from my text box is on. How do you make the what look for a variable. I can get it to work if i put a constent in the what. how to make the what look for a variable. I'm new at this forum thing so im not quite sure how to check for answers.
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.
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 ).
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
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)
I need to create a formula in a spreadsheet so that when KWD or BHD is entered into a cell then another cell changes to 8 decimal places if neither of these are in the box then it needs to be 7 decimals! But the box that is changing needs to be alterable.
I have posted this on a non excel specialised forums and i got this answer:
in cell x you have "kwd" in cell y you put: =IF(cell X="kwd",TEXT(cell Z,"#,##0.00000000"),TEXT(CELL z,"#,##0.0000000")) in cell Z you put the value that you want to be alterable
I am using this formula to output data into a cell:
=MID(A1,4,2)
The cell value is 50. I am wanting it to appear as 5.0 instead. Can I do this by adding to the formula above or will I need to utilize another cell to accomplish this?
I need a function to find the number of decimal places of a certain number (in this specific case doubles)
The first solution would be something like this:
Code: 'returns the number of decimal places within a double Public Function getDecPlaces(inputNum As Double) As Long Dim ndx As Long ndx = InStr(1, inputNum, ".") If ndx > 0 Then getDecPlaces = Len$(CStr(inputNum)) - ndx End If End Function
But i feel there is likely a much better way of doing this..
I have created a userdefined function. the Idea is for the user to calculate the difference in hours and minutes. The input would be like budtime = 30 , realtime = 1.25 the answer I would like to have is 28:45 (28hours and 45 mins). Im aware that I can format the cell manually with [h]:mm but I'd like the function to do it. I have written this:
Function RT(BudTime, RealTime) RT = Format(((CDec(BudTime) - CDec(RealTime) / 24)), "[h]:mm") End Function
Any function in Excel, that would allow me to have a unit cost price (for example: 0.5432) and then for a table of figures containing the pack sizes to determine the correct unit price that would allow all pack costs to be at 2 decimal places. I have included an example below:
My spreadsheet would look like the following:
Cell A1 (Unit Cost Price) = .5814 Cell A3 (Pack of 75 units) = .5814*75 = 43.605 Cell A4 (Pack of 80 units) = .5814*80 = 46.512 Cell A5 (Pack of 100 units) = .5814*100 = 58.14 and so on
I need some way of making cell A1 change to a value that will cause all cells A3 to A5 to be 2 decimal places or less.
firstly I did txt to columns, then I found some data changed to scientific format which is not I wanted as I could not convert it using function HEX2DEC.
On my indows XP box, when I type a number into an Excel spreadsheet and it is in "General" format, the numbers appears like this (examples):
1234567
or this:
7.125
or this:
8.1
I want them to look just like that except for the first one, which I want to have the thousands separator:
1,234,567
I don't want to use a number format because Excel makes you set a specific number of decimal places...I want the decimal places to float depending on how many decimal places there are in the entered number (just like the "General" format does). So basically, I want a "General" format, but with thousands separators (commas).
I tried using something like ###,###.### but that leaves a decimal place at the end of each integer (i.e. "123,456.") which is also not acceptable.
I have a vba macro that takes data from one workbook and pastes it into another workbook. In doing this I have declared a few variables of type single (I only need two decimal precision). However, when I copy the values from the cells on the source workbook and paste them into the target workbook, the numbers end up having 12 decimal places. Ultimately, this extra precision causes my totals to be off by .01 or more after a while. I have tried rounding the number as I pull it off the source workbook into the variable, but that didn't matter. How do I solve this problem? Code for pulling data from source workbook:...
Basically, I want to format a group of cells to display 1 decimal figure if the number is not a whole number. If the number is a whole number (or if the rounded first decimal place is 0) I want it to display no decimal.
I am wondering if there is any way to "force" a number to have three decimal places instead of two and still have that number valued as a number for use in formulas later (like AVERAGE, etc.).
What I have is a combination of HLOOKUPs, IF statements, and Conditional Formatting.
I have a Master Grades sheet and individual Class sheets. I use an HLOOKUP, matching a Student Number in both sheets, and looking in the Class sheet for the P/F indicator. If the indicator is a F, the HLOOKUP is to return the Final Grade from the Class sheet and input that into the Master Grades sheet, forced to three decimal places (whereas the numbers in the Class sheets are at two decimal places) If the indicator is P, the HLOOKUP simply returns the Final Grade from the Class sheet and inputs it into the Master Grades sheet with two decimal places.
I have the failure grades forced to three decimal places so that the Conditional Formatting in the Master Grades sheet highlights the failed grades for teachers and anyone else can see right away that a student failed, but the number still allows the Master Grades sheet to calculate the overall AVERAGE for the student as well as the AVERAGE for that class.
If any of this is not quite clear, please ask and I can further expand on what I am doing.
Here is the code I have right now that is not working correctly (and I know why it's not): ....