Calculation Accuracy Error
May 3, 2007
I have an issue with a very simple feature of excel.
When I enter a simple formula like: =1.2222-1.2211 , the answer is not 0.0011 but 0.0011000000000001 (if you increase decimals).
This error annoys me because if I use conditionnal formating (for example change color to red if value is 0.0011) then it will not work !!!
What is the reason of this error? Do you know where this comes from and how to avoid it? My figures usually go after 5 decimals.
If I use "Precision as displayed", the result of the calculation will be the same as before, but the Conditional formatting will work until I display too much decimal figures.
I think it is an issue that is well known and might be already raised somewhere in the forum but I do not know exactly how to search for it (I do not know the exact terms in English...).
I am using Excel 97.
View 9 Replies
ADVERTISEMENT
Feb 23, 2014
I am interested in matching numbers. How to develop this:
=INDEX(All!E:E,IFERROR(MATCH(LEFT(B2,16)*1,All!A:A,0),IFERROR(MATCH(LEFT(B2,15)*1,All!A:A,0),
IFERROR(MATCH(LEFT(B2,14)*1,All!A:A,0),IFERROR(MATCH(LEFT(B2,13)*1,All!A:A,0),
IFERROR(MATCH(LEFT(B2,12)*1,All!A:A,0),IFERROR(MATCH(LEFT(B2,11)*1,All!A:A,0),
[Code] .....
It looks at what is in cell B2
It starts with the first 16 numbers and tries to match it with data in Col A of the sheet All!. If it finds a match it reports the data in the corresponding row of col E in sheet All.
If it cant match that it looks for the first 15 numbers and tries to match, then 14 then 13 etc etc.
Its often the case that the data in Col A of All is much shorter than the data in B2, so this works well.
The value in B2 is a telephone number. The values in Col A are Dial prefixes on a carriers rate card so the number is matched to the carriers rate card in the best way possible.
But I need to apply a different method for a different project.
The statement above gradually diminishes the accuracy of the number in cell B2
What I want to do is simultaneously diminish the accuracy of the two numbers to be matched.
For a successful match, the length of the number must be the same. So len(B2) must match len(matched cell).
But, the last number might not be the same. If there is no match, look at the numbers and see if there is a match if all the numbers are the same excluding the last 2 numbers in both, if no match, exclude the last 3 numbers in both, if no match exclude that last 4 numbers in both. Etc etc.
View 7 Replies
View Related
Nov 9, 2009
Take a look at this sample sheet.
LapCounter.xls
In it I've developed some lap timers for tracking runners. However to be truly useful, each time I press a LAP button on any one row it really needs to record time with millisecond accuracy, which it currently does not.
View 9 Replies
View Related
Dec 30, 2013
we all have a team, and we are scored on calls, appointments, demos, proposals, and revenue. Rather than asking us to do one or all of these metrics, I would like to have a bulls eye chart that could show people their bonus eligability, so if for example 50% of the circles are touching the bulls eye circle, you would be able to adjust what you need to work on for bonus.
Here is a sample graph.
sample structure.jpg
Here is sample data I am trying to work withsampledata2.xlsx
View 1 Replies
View Related
Sep 11, 2007
I want to calculate the number of weerks in a year. I use the following formula that seems to work
View 14 Replies
View Related
Jan 30, 2007
Is there any way that the #N/A can be turned off or hidden and the cell left blank?
View 6 Replies
View Related
Jan 30, 2008
I currently have a userform which inputs data into two cells, the third then multiplies these two cells together, which is all honky dory. It works, 2 x 2 = 4.
But when i put 0.6 for example it really doesnt work. 0.6 x 25 = 25. WRONG. My code in the macro is fairly long winded but will paste anyway.
If ComboBox2.Text = "Pounds (£)" Then
Sheets("Claims").Range("G16") = TextBox2.Text
Else
Sheets("Claims").Range("F16") = TextBox2.Text
End If
Sheets("Claims").Range("B16") = ComboBox1.Text
Sheets("Claims").Range("C16") = TextBox1.Text
Sheets("Claims").Range("B16") = TextBox3.Text
Sheets("Claims").Range("D16") = TextBox4.Text
Sheets("Claims").Range("E16") = TextBox5.Text
Dim a As Long
Dim b As Long
Dim answer As Long
a = Sheets("Claims").[E16]
b = Sheets("Claims").[F16]
answer = (a * b)
Sheets("Claims").[G16] = answer
View 3 Replies
View Related
Jun 16, 2007
i use this line inside an addin. Application.Calculation = xlCalculationManual. only when I open the XL App, the addin is uploding, so when excution comes to the line, it gives this error: Run Time Error 1004 "Method calculation of object Application Failed". however, when the XL App is already openned, then uploading or unloading the Addin cause no problem
View 2 Replies
View Related
Nov 19, 2008
make a calculation(addition) and use the answer to multiply against another addition calculation....
The sum of (Monday!A1:A4) multiplied by the sum of (Monday!B1:B4) plus (Tuesday!A1:A4) multiplied by the sum of (Tuesday!B1:B4) and so on.
View 2 Replies
View Related
May 29, 2014
Error Check Marco.xlsm
see attached example. I am trying to write an error detection routine that iterates through worksheets that have numeric values for names (ignore text names or alphanumeric). Macro checks range on each numeric worksheet E3:E33 and is supposed to report back on the SummarySheet if any value other than 1 or 0 is found in range E3:E33 on any numeric-name worksheet. Code as follows:
[Code] ....
Problem is that it just reports EVERY worksheet as having an error when clearly most don't (none do I think in the attached example).
Try changing some of ranges E3:E33 to values other than 1 or 0, it still reports all sheets. Why the macro does not evaluate the range E3:E33 properly and just reports every worksheet as having an error?
View 8 Replies
View Related
Nov 9, 2009
See the attached sheet. I am trying to add together two figs which are linked to calculations which have formula built in to stop error messages when there is a 0 / 0 = #value type error. However when these two cells are added, if the cells are blank I get an error message. And if only one cell has a value, I get "" with my existing formula. what I need to do to get a result of 7 if for example cell A4 = "" + B4 =7. At the moment my formula shows "" in the sum total of these cells
View 5 Replies
View Related
Apr 1, 2013
OK, so I have a userform with some text boxes that I have specially formatted to accept only date values in the form of mm/dd/yy. By default they are blank. I have a check in one of my codes that looks like this
Code:
If DateBox vbNullString And DateValue(DateBox) > checkdate Then
M1 = "NEOPRENE" & Chr(13)
Else
M1 = "" & Chr(13)
End If
Where DateBox is this specially formatted TextBox and checkdate is a future date being checked against.So if DateBox has a value in it AND that value is greater than the date being checked against the returend string is Neoprene, otherwise it is blank.
Well the problem I have is when the first condition returns FALSE, i.e. when DateBox is empty, the DateValue half still gets evaluated and returns a type missmatch error or something like that because DateValue("") returns an error. I have line of code 8 times, one for Neoprene, squeegee, etc. So the name of the text boxes are each unique and I am using M1, M2, M3, etc.
For other reasons, use of "On Error Resume Next" doesn't work for this situation because it causes a result opposite to what I want to happen.
View 2 Replies
View Related
Jul 2, 2006
the if stattement works perfectly and does exactly what i want except when it comes to the else part. if there is no error the statements are run perfectly but if there is an error (in this case the error is generated when a match cannot be found in the spreadsheet) the else statement doesnt kick in and post the msgbox.
the code just crashes. and returns an error 1004 on the line i have highlighted in yellow
res = WorksheetFunction.Match(invvar, Columns(1), 0)
If Not IsError(res) Then
Me.txtClientID.Value = ws13. Cells(res, 7)
Me.txtNumber.Value = ws13.Cells(res, 7)
Me.txtDate.Value = ws13.Cells(res, 8)
'save client id as a variable
'Print to invoice------------------------------------------------------------------.....................
View 6 Replies
View Related
Feb 7, 2007
I am trying to run create a simple macro that copies and paste special values - something I have done 100's of times but for some reason I keep getting an error message - even though I recorded the macro and didnt write it by hand - see below:
Sub Macro6()
Cells.Select
selection.Copy
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
For which I get 'Compile Error - Expected Function or Variable'
View 6 Replies
View Related
Apr 26, 2006
I have some code that, although works fine in Excel 2003, does not in Excel 1997. I receive this error when I try running it:
COMPILE ERROR:
NAMED ARGUMENT NOT FOUND
Sub HPVAL()
Dim r As Range, myStr As String
myStr = "HP"
Set r = Cells. Find(What:=myStr, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If Not r Is Nothing Then
r = r.Value
While Not r Is Nothing
Set r = Cells.FindNext(r)
If Not r Is Nothing Then
r = r.Value
End If
Wend
End If
End Sub
It looks like Excel is getting hung up on the "SearchFormat:=" portion of the code.
View 2 Replies
View Related
Sep 12, 2012
So the issue I am having is that I have a worksheet with two long rows of value. If the user enters the incorrect value, the program gives a error case of 1004. If and when this error occurs I want the program to send a MessageBox to the user then end the program. The problem that I am running into is that whenever I write On Error Goto... It Goes to the label whenever any runtime error occurs. My belief is that there has to be a way to only check for a runtime error on a single line of code rather than the entire sub.
View 3 Replies
View Related
Oct 8, 2008
I have written a Excel (2003) that searches a worksheet for a string in any cell. If the string is not found, it uses the 'On Error GoTo' command to jump to a given label. It works fine on the first string not found. When it searches for the next non-existent string, it fails with:
'Run-time error '91':
Object variable or With block variable not set'
Do I have to clear a buffer after each cells.find search?
My
View 7 Replies
View Related
May 20, 2009
I am looking for a more efficient way to write a macro (a sample from the macro is below). This is just the first part of the macro. I need to repeat these same steps (seen for row 5 below) for rows 5 to 50. My script worked until I hit row 35 and then I got the "compile error.." message. There must be a way to use "loop" to write this more efficiently, no?
View 14 Replies
View Related
Apr 13, 2006
whether I can handle errors in a way that tells me which object caused the error?
For example if a userform has two combobox's and one causes an error, can I return to a message box containing the name of the object (combobox1 or combobox2)?
I have tried returning err.source but I am either not using it correctly or it isn't intended to be used this way.
View 3 Replies
View Related
May 3, 2006
I'm getting the error for the following piece of code.
Sub itconfandscratch()
Dim Cn As ADODB.Connection
Dim Server_Name As String
Dim Database_Name As String
Dim User_ID As String
Dim Password As String
Dim SQLStr As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Server_Name = "sturecord"
Database_Name = "Scratch" ' Enter your database name here
SQLStr = "SELECT stuname FROM dbo.sturec" ' Enter your SQL here
Set Cn = New ADODB.Connection
Cn.Open "Driver={SQL Server};Server=" & Server_Name & ";Database=" & Database_Name & ""..............
View 2 Replies
View Related
Dec 19, 2006
the spreadsheet needs to be copied to a directory called "C:downloads" as it contains a ODBC query to itself (In reality, this is a query to an External Oracle Database)
On loading, it should pop up a simple userform, with a combo and two command buttons, which when pressed takes you to a (hidden) tab that displays a pivottable.
All works well until I try to close /save when 60% of the time, Excel encounters problems and closes and will not load up the file the next time until either quit excel or disable macros. Messages include "file/path access error", "I/O Error" or get restarts excel.
On a casual run through, I expect you might report back that "All worked ok for me". Please can you give it a bit of a thrashing, comment out the userform show, save the file (frequently) becuase i assure you it will break ultimately!
This is a brand-new file and I've tried it on about 5 different PC running different versions of Excel and generally get the same result.
View 7 Replies
View Related
Apr 27, 2007
my lookup isnt returning the correct data- already tried sorting it doesnt work im pretty sure ive put in the correct formula
View 6 Replies
View Related
Oct 20, 2006
I have a very simple spreadsheet that generates a "backing page" for items to be physically pasted to (essentially nothing more than printing a header). I have the following code under "This Workbook" to avoid being prompted to save changes when closing, as this spreadsheet is just a template and changes should not be saved...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Close False
End Sub
The code does as is intended, but, if any other spreadsheets are open at the same time, I get an error message pop-up saying "EXCEL has encountered an error - an error log has been generated"... Excel then shuts down. So, first question; where should I look for the error log?
View 2 Replies
View Related
May 17, 2014
VB:
Selection.FormulaArray = _
"=IF(RC[-7]=""Weekly"",RC[-1],IF((ParentCode=RC[-10])*(ClassType=""Active""),IF((EndDate=EOMONTH(EndDate,0))*(RC[-7]
={""Monthly"",""Quarterly""}),RC[-1],0),IF(RC[-7]=""Daily"",IF(SUMPRODUCT(((ParentCode=RC[-10])*(FundType=""C"")*
(ClassType=""Inactive Class"")*(TermDate<>"""")*(TermDate>=StartDate)*(TermDate<=EndDate))+((ParentCode=RC[-10])*
[Code] .....
I recorded macro for this formula its giving me syntax error i did " _" after the break but its still not working..
View 4 Replies
View Related
Aug 19, 2009
Before I go into details I am working in one workbook with several worksheets(Tabs) in the workbook. I have three Buttons on one tab. the button I am having trouble with is the third. I want to insert a column in a separate tab that contains approximately 87,000 rows of data. I then want to do a row count and select the empty cells in the inserted column and put a formula in there. I have tried a loop VBA code and it works, but it takes about 30 minutes to run all the way through. The underlined portion is what is higlighted with error 1004: Application-defined ro object-defined error. I am not sure how to fix this. This is what I have now:
View 13 Replies
View Related
Feb 2, 2010
I imported some data from an MDB file while working at home. created a macro to that effect. and it works fine at my home PC. but when i try t execute this macro on another PC or work place, then it gives error #13. i dont understand why. something is wrong with the code. i think it is the "WITH" code for query tables connection giving error ....
View 9 Replies
View Related
Oct 29, 2009
I'm trying to copy an ELOOKUP formula down a column in a sheet. The formula is losing part of the table array when I carry it down and returning an N/A error. Interestingly, it will work when I copy it across a row.
View 9 Replies
View Related
Feb 1, 2010
"Compile error - Syntax Error"
and the following line highlighted in yellow
"Sub CreateWorkbooks()"
It worked on Excel 2000 but not now and dont work either in Excel 2007.
Heres the complete code .....
View 9 Replies
View Related
Oct 17, 2006
I have a VB function in a worksheet that requires data from a workbook that is not under my control. The problem is that the workbook does not always have complete data. Often cells are filled with #VALUE, when this occurs I need a way to tell my VBA to assume a value of 0. I have tried using if(cell="#VALUE", 0,cell) but to no avail. any suggestions?
View 7 Replies
View Related
Oct 12, 2007
I have a series of monthly revenues and want to calculate each month a commission % - but only want this commission calculated up to a defined limit from the previous months and current month and then to stop when the limit is reached.
View 13 Replies
View Related