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


ADVERTISEMENT

Converting Decimal Numbers To Text With Dot Numbers

May 27, 2006

we work with both Lotus 123 and Excel 2003. Lotus will be gone next year, but for now, the official mean to publish our reports is Lotus. With my work, I copy/paste a Lotus page to Excel. I use the following macro to convert Lotus format numbers (which Excel considers as text) to real numbers:

Sub ForceToNumber()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
With wSheet
. Range("IV65536") = vbNullString
.Range("IV65536").Copy
.UsedRange.PasteSpecial xlPasteValues, xlPasteSpecialOperationAdd
End With
Next wSheet
End Sub

Source : http://www.ozgrid.com/forum/showthre...087#post184087. The problem is that I need to send back this data in Lotus. Excel considers decimal numbers with a coma as real numbers and numbers with a dot as a text. This previous macro fixes that. However, Lotus works the other way. Only numbers with a dot are considered real numbers. So I would need to find a way to code a macro that converts any numbers in the Excel sheet to a number with a dot. It's a bit like doing the opposite operation.

View 3 Replies View Related

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 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

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

List Only Whole Numbers From Decimal Numbers

May 23, 2009

From a list of numbers I would like to delete values that have cents so only those transactions with a .00 amount are displayed

For example

34.95
21.88
21.00
56.00
45.77

Only those valaues ending in .00 will list. I tried filtering but I think there most be a function(s) string that might work or at least filter out the values with cents

View 4 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

Compare 2 Columns For Numbers In Mixed Text & Numbers

May 3, 2006

I need to compare two colums by number decription for example m344 in one column and fsh344-1 in another. All I want to match is 344. In column a I want to indcate the match by placing an X by each match. View my attachment for reference. I don't know if it makes a difference but the columns are centered in my original spreadsheet.

View 8 Replies View Related

Delete Decimal Numbers Only?

Dec 14, 2008

Is there a way to delete only numbers ending in a decimal from a column of numbers? I have a column of numbers but only the non decimals are relevant to the next equation.

View 3 Replies View Related

Counting Decimal Numbers

Oct 25, 2006

I am trying to find a way of counting decimal numbers if, say, they begin with 3.

For example, I might have 3.33, 4.1, 3.0, 5.65, 3.8, 3.7, 3.33, etc.

I want to count anything that begins with 3 (3.33, 3.0, etc). Using the data above the answer would be 5 ...5 numbers that begin with a 3.

If this possible?

There doesn't appear to be the facility with Countif. I don't want to truncate the data (the spreadsheet already is quite extensive). I have tried using =SUMPRODUCT((Y$2:Y$170 >=3)*(Y$2:Y$170<=3.9)) but this will return an answer only when there is a complete set of data within cells within the range.

View 10 Replies View Related

Spliting Numbers Regarding Decimal

Aug 8, 2008

I would have a preliminary data, a number, on sheet1. The final data would be on sheet2.

In the case where there is a whole number as the preliminary data, the data would remain the same as the final output. (eg. 248 --> 248)

In the case where there is a number with a decimal, I need a function where it looks at the original number as two sets of WHOLE numbers. (Eg. 248.30 --> 248 and 30). Where the digits to the left of the decimal remains the same and the digits to the right would be divided by x (in this case, 10). The final output would be 2483 (where 248 is the same and the 30 is divided by 10.

Since I am using an older version of excel, I cannot use quotient. I know that I would be using the vlookup function and perhaps an if function. however, I do not know how to separate the numbers in regards to the decimal.

View 12 Replies View Related

Convertering All Numbers To Decimal

Feb 16, 2007

My coworker's excel program is converting all data to decimals. He enters in 2004 as a date and it makes it 2.004. I opened the same file on my computer and it works fine. I have done all fo the formatting to try and make it a number or a general field. The general field is not showing a preview as if there is some error overriding the whole program. He has some other numbers that he has already entered as currency and they work fine. I was able to do a =2004 and it showed as 2004 of course.

View 3 Replies View Related

Whole Numbers Being Changed To Decimal

Apr 29, 2007

when I tried to input numbers into an Excel spreadsheet (Excel 2003) the numbers were entered as decimals. Example: I type in 235 with NO decimal point, Excel enters it as 2.35, even when starting from scratch, using a new sheet or new workbook. I tried using format cell from the menu bar to choose "general" then as "number". Nothing changed. I also tried to set the decimal places at "0" using the number format. All that did was truncate the number to 2 with the .35 not being displayed in the cell. It IS displayed in the formula window as 2.35... but not as I entered it... 235. This happens no matter whether or not it's a brand new blank workbook or worksheet

View 2 Replies View Related

Subtracting Time (in Numbers) To Decimal

Oct 21, 2009

How can I add/subtract time entered as 1830 to give a decimal value?

Start=1830
Finish=2000
Time between = 1.5

Also, how can I convert time as 1830 (24hr) to 12hr time? ie. 0630.

View 3 Replies View Related

Allow Only In Textbox1 Numbers & Decimal Point?

Jan 31, 2014

I need to allow only in textbox1 Numbers & decimal Point.

View 4 Replies View Related

Decimal Numbers To Feet And Inches

Jan 19, 2004

Is there a way to store a text style that will allow me to convert decimal numbers into feet and inches in the same cell?

I want to be able to type in a number like 3.5 and have it read 3'-6".

View 9 Replies View Related

Parse Decimal Numbers From Text

Nov 6, 2006

A while back I asked how to remove the letters from entries that have both numbers and letters. I as pointed to a UDF called "ExtractNumber".

Here is the code for that UDF: .....

View 9 Replies View Related

Add X Decimal Places To Numbers But Not Zeros

May 24, 2008

I have a column of numbers with one decimal point and some blank entries too. I need to convert all the numbers (including the zeros, but not the blanks) to two decimal points. Any idea on how this can be done?

Examples: 0.1 needs to become 0.10, 0 needs to stay 0, a Blank cell needs to remain Blank.

View 9 Replies View Related

Validate TextBox For Decimal Numbers

Jun 6, 2008

I have set up a form which requires one textbox to have a decimal followed by four numbers (ex .5780) and another which requires two numbers, a decimal, then two more numbers (ex 57.80). how this can be accomplished? I am new to Visual Basic coding!

View 6 Replies View Related

Excel 2010 :: Sum And Average Of Decimal Numbers

Apr 10, 2014

Basic Excel-2010 functions.

I have given a table with some decimal values like e.g 0.3658 0.358 0.485 0.7863 0.558 0.858 0.985, I want to find the sum and average of these number.

1) I have tried the autosum or auto Function =AVERAGE(A2:A7) but it yields #DIV/0! error
2) when I use =AVERAGEA(A2:A7), it yield ans=0
3) puttin =ROUND(AVERAGEA(H2:H23);3) also yields 0;

View 4 Replies View Related

Changing The Decimal Places Without Rounding The Numbers

Mar 19, 2009

I was trying to decrease the decimal places of the data figures that I'm currently working on my report, however, it keeps rounding-up the decimal numbers. I wish to keep the original numbers and just decrease the decimal places.

For example:
The original figure is = 7260.12903225806
Upon decreasing the decimal figures to just 2, the result became = 7260.13

Is it possible for me to just have this result = 7260.12 instead of 7260.13?

I've tried using the TRUNC formula butit does not work if the 2nd decimal value is 0.

For example:
The original figure is = 227161.905808985
Upon applying the formula, the result became = 227161.9 instead of 227161.90

View 4 Replies View Related

Remove The Display Of The Leading Zero In Decimal Numbers

May 15, 2009

Is it possible to remove the display of the leading zero in decimal numbers of less than one in Excel 2007?

View 3 Replies View Related

Code Writes Decimal Numbers Next To Each Other Instead Of Adding

Sep 4, 2009

Code writes decimal numbers next to each other instead of adding. I have the following code on a very simple form:

View 5 Replies View Related

Require 2 Numbers Before A Decimal In Data Validation?

Feb 16, 2012

How can I require 2 numbers before a decimal in data validation? I have a formula to require at least to characters after.

I'd like to require the user to enter at least ##.##

View 9 Replies View Related

Filter Only Decimal Numbers - Result In Same Column

Apr 3, 2012

I have few numbers in Column "A". Few are normal figures & few are decimal numbers, like this:

20
5
5.63
4.5
200
53.263
125.5

Now I want to filter only the decimal numbers, so that after filter the result will show like this:

5.63
4.5
53.263
125.5

But I don't want to use any other column for doing so. I can do it using MOD in other column but I want the result in the same column.

View 7 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

Converting Decimal Numbers To Minutes And Seconds

Jul 27, 2009

I have an excel sheet with a row of numbers example below. These numbers represent the length of time that a telephone call was. The problem is they are decimal numbers (units of 100) but they represent seconds and minutes of a phone call which change up one number when the seconds hit 60 ...

View 9 Replies View Related

Reducing Decimal Points Without Rounding Up The Numbers

Jul 25, 2006

I have columns of geological data in number form which may have about 4 or 5 decimal points. I want to reduce them to 2 decimal points without rounding the numbers up. Is there a simple way to do this?

View 4 Replies View Related







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