Floating Point Calculations Adding Values?
Jun 25, 2014Why the following (do it in the immediate pane) gets the wrong answer in VBA.
[Code] .....
this should return 0.1 but what you get is
9.99999999999996E-02
Why the following (do it in the immediate pane) gets the wrong answer in VBA.
[Code] .....
this should return 0.1 but what you get is
9.99999999999996E-02
See here:
http://www6.uniovi.es/~antonio/uned/...-754hex32.html
This site allows me to enter a 32-bit Hexadecimal Representation and get Decimal Floating-Point result.
For instance, 4224A012 gives me 41.2.
Is there a UDF available to do this inside of Excel?
convert a decimal number entered into a cell into its hex representation? 32-bit floating point representation.
View 10 Replies View RelatedI have a byte array that contains a 4 byte floating point number. How would I convert this byte array to the single typed floating point number it contains?
I have created a chart in a chart sheet (using VBA) - all well and good. Now I notice that if I place the mouse pointer over any of the pie slices, I see text similar to the following
Series 1 point "Swedbank" Value: nnnnnn (n%)
Now obviously (?), the name Swedbank is from the source data and the nnnnn (n%) are the values to be plotted. I'm wondering 2 things Can I "format" that text in any way, for example, so it shows Swedbank, value: nnnnn (n%)If I can, can I also format the numbers so that'll end up something like 1 234 567
I want to collect data from multiple files that have multiple sheets and data in them. Basically what I want to do is to copy every 600th data point for 6 times (1 hour) and then move to the next sheet. Once done with the sheets, I want to move to the next file. I had done a similar code before that worked, and now that I tweaked it, it doesn't work. Plus I'm getting a compiler message telling that "For control variable already in use". I have attached the code I'm using below.
[Code] ......
I have a problem as I need to present data with different data sources. I'd like the calculations to be as "automatic" as possible. The data consists of countries and regions and their sales pipe. The pivot table doesn't give me all the data that I need to present so I need to add extra columns with calculations and data from other data sources.
The problem I meet is that the 'total row' within each group needs to be reflected in my columns as well (F:G) It works as long as the data I've imported has the same amount of States within each group of Contry but if the number of states differs with the newly imported data - my "manual" columns are wrong.
(A;B;C;D;E;F;G;H)
Country;State; Red; Amber; Green; Quota; Total PV; Coverage;
I've created a Pivot table on the first 5 columns [Country; ...; Risk] (A:E)
The following columns are manually entered based on the pivot (F:H)
Quota (data source from another sheet)
Total PV (a sum of Red; Amber; Green in the Pivot)
Coverage (returns % of TotalPV/Quota)
For each group Quota and Total PV needs to summarize the above data within the group. I've 'hard coded it' today (SUM(F3:F5)) - F3:F5 can as well be F3:F8 or F3:F4 depending on the imported data. I have 8 different Countries (groups) with different amounts of States and 3 different sheets for each Region of countries so I need this summary to be automatic based on what group (Country) it belongs to. How can I make the calculation different so that it's dynamic as well as the Pivot table? Today it's not dynamic and it needs my 'hands on'.
Quota =IF(ISNUMBER(SEARCH("total";A6)); SUM(F3:F5); IF(ISNA(VLOOKUP(B6;Quota!B:F;3; FALSE));" ";
IF(VLOOKUP(B6;Quota!B:F;3; FALSE)=0; " ";(VLOOKUP(B6;Quota!B:F;3; FALSE))))).
I'm looking to change raw data into a "point" system. One of my value exchanges is every $1,000 equals 5 points. So if cell A1 equals $4,685 I am looking for cell A2 to give me a value of 20. (5pts times 4 increments of a $1k) The point value only changes at the $1k milestones, so the remaining $685 does not change the point value. What would the formula look like for something like this?
View 3 Replies View RelatedI have a pivot table as shown below which is pretty straight forward however I am trying to create a macro that will automatically change the point name to match the point name in column E then copy that resulting dispaly to another sheet then pick the next point name in line and do the same thing and repeat for 50 rows, so my end result will be 50 pivot tables ready for printing. I can do this manually but I am trying to make it automatic...BTW the point names in column E change everyday but the pivot table supports the name changes.
Option Explicit
Sub PointName()
Dim Ws As Worksheet
Dim Rng As Range, Cel As Range
Set Ws = ActiveSheet
Set Rng = Range(Cells(2, 7), Cells(Rows.Count, 7).End(xlUp))
For Each Cel In Rng
Ws.PivotTables("PivotTable1").PivotFields("Point Name").CurrentPage = Cel & " "
Ws.Columns("A:B").Copy
Sheets.Add
With ActiveSheet
.Paste
.Name = Trim(Cel)
.Range("A1").Select
End With
Next
Ws.Activate
End Sub
I turned it off for a while and when I turned it back on I am getting an error
Unable to set the _Default property of the PivotItem class
Debugger is highlighting
Ws.PivotTables("PivotTable1").PivotFields("Point Name").CurrentPage = Cel & " "
I've tried changing the cell format of some number values to text, so the numbers are not read and calculated in to certain formulas, but they're still included in the calculation. I need all values to display in the spreadsheet, but I need exclude a range that would vary.
Is it possible to just change the cell format, so numbers are ignored by a formula?
having a different calculations performed within a Textbox on a Userform depending on the selection made in a Combo Box. This was answered here.
Perform Calculation In Textbox On Userform
I have another question regarding this problem, however the thread is closed so I have posted a new thread.
The original question was answered and the solution works very well,however I now need to be able to use the selection from two (2) comboboxes to initiate the various calculations in a similar vain.
have a look at the original thread to get an idea of what I am looking for here.
I have tried many configurations of various code, all of which works to an extent buts which falls over in certain circumstances.
I am working up a workbook template that will be used to process survey results. The way I ultimatley want it to work is that the user can paste data from another application into a worksheet in Excel, and then view analysed results on a second sheet (which are processed via formulae on a third, hidden sheet).
The problem I have is this: the data from the program that's capturing them are text values. For example, column B contains answers to a question where participants rate an experience, and the values are either "Excellent", "Good", "Fair", "Poor", "Awful". I want these to be converted to numerical values, on a scale where "Excellent" = 5 and "Awful" = 1, so that I can then average these.
So, the question is: Can I somehow tell Excel that "Excellent" = 5 and "Good" = 4 etc, and then use AVERAGE(B:B) on the text data and get a number back?
I did think of having an intermediate sheet that used VLOOKUP to create a copy of the first sheet (where the user pastes the text data) with the text replaced by numbers. But, because I don't know in advance how many rows will contain data (i.e. how many survey results there will be), I have to assume on the high side and copy down 50,000 rows. But, this takes ages to calculate.
I've got an excel sheet that lets people choose between 2 choices. I'm using scroll bars to make it easy for them to choose and visualize their preference with as little mouse clicks as possible. The scroll bar is only one sided though, meaning it starts from a min value to a max value.
I would like a scroll bar with a of 0, with the value increasing positively as the user scrolls to the left, and the value also increasing positively as it scrolls to the right.
I am trying to add numbers from cells if it IsNumeric and for some reason in column K the macro doesnt recognize numbers after row 14?
The range column is "E4:E"
Search criteria is the letter "R" in column "E" Then using OffSet, I go thru other columns and process data. Most of the macro works except for column K after row 14?
I have a section of my program that asks for board scores (point value is 6-10 in increments of .5) I have set up a data validation so that users can only enter those specific values. Problem is, none of the values can be more than 1 point from each other. (the part I have yet to figure out)
Example, if the first value is a 6.5 the second is 7.0 and the third is a 9.0, I need the data validation to display an error because the 9.0 is beyond the one point spread.
Summary: Display an error message if any of the points are more than 1.0 point from another.
Basically, I have a Userform and am trying to have a user enter 1 datapoint into a Textbox. Based upon that datapoint (it's 9 digits), I am trying to see if I can therefore reference a linked Access Table to fill in other textboxes with information tied to that record (so if they enter a unqiue ID, I want to automatically return Name of Person, Location, etc.) . I liken it to a vlookup in regular Excel but am just not sure how to go about it in VBA.
View 2 Replies View RelatedI'm trying to create a macro that when run, scans Row 12 (only after column E), Finds the first empty cell, then inserts the cell value from Sheet4 CellE8. Then the hard bit begins. I need it to insert cell info in all the cells below it, from different locations...
For example
A
B
C
D
[Code].....
In the above sheet, I need it to go to cell D2 and insert the values from Sheet4 CellE8, Then proceed to D3 and insert data from Sheet3 D4, then to cell D5 and insert data from Sheet1 A7, etc etc
I dont mind doing each cell individually, but they will always be in the same column (and row 2 "Value" will always be the one that determines the next empty column).
The sheet has a price list (I attached the sheet). its a width x height(drop) format. If width or height <= minimum width/height then use the minimum listed. if width or height > minimum <=maximum then lookup in table next heightest value. here is the complication. any oversized items are priced as roundup((size -biggest size) / (biggest - second biggest size),0) * ( price of biggest-price of second biggest). so if my widths are
4600 4700 4800
10 25 35
and I am pricing 5050 I would do :-
calculate howmuch its oversize
5050-4800 = 250
Calculate the difference in the last 2 sizes
4800-4700 = 100
Calculate the rounded up multiples
250/100=2.5 rounded up = 3...........
I have a list of grades they are 3a, 3b, 3c, 4a, 4b, 4c, etc up to 7a. An a is one grade than a b, and a b is one grade higher than a c. In one test a student may score a 4b and in another a 4a. I need a way to calculate the difference in "grades" e.g if a student scores a 4a in test 1 and a 5c in test 2 the difference is 1.
Is there a way I can do this using custom formatting or will I have to assign values to the grades and insert extra columns to do the calculations. I need the simpliest way as I have to disseminate to my staff in my department.
I have a textbox that constantly shows the contents of cell B1, a changing cell, as it is a total formula (to make my textbox display the contents of cell B1 I clicked on the textbox and then entered =B1 in the formula bar).
Trouble is, my textbox scrolls with the rest of my sheet and soon disappears from the screen. I need it to float on the screen and remain always visible when the sheet scrolls far up or down. How can I achieve that?
Or is there any other floating object that will constantly display the changing contents of cell B1? I’ve tried a textbox within a UserForm (which does float and remains always visible) but I cannot make that textbox display the contents of B1.
I wish to have a floating link in large spreadsheets that will always be visible and when clicked will return to a particular cell in that same spreadsheet.
View 2 Replies View RelatedIs there any code available for a floating Message Box instead of Standard Message where by the user can scroll the sheet and decide to choose "Yes" or "No".
View 4 Replies View Relatedif it is possible to create a floating Tab like you get on websites, so ehwn you move the spreadsheet to the left or right, the tab/shape with words in moves with you.
View 8 Replies View RelatedI was asked by a co worker if there is a way to make a data table float b/w tabs or in other words, it would always be visible no matter what tab or location you are in a workbook.
My first answer was no, that he would need to create that table on each tab and freeze the panes so that it was visible no matter where he was in his workbook.
cell A1 contains the numeric value: 3961.3
cell A2 contains the follwing: ="z equals "&B3-3933.7
which i would expect to give me: "z equals 27.6"
BUT, it gives me: "z equals 27.600000004"
which is awefully strange becos the 4 comes form nowhere...
what makes some sort of sense is that if the value in A1 is changed to 3961.4 or 3961.5, then the final decimal 4 in A2 changes into a 3, and then a 2.
when the value in A1 is changed to xxxx.7 the number in cell A2 becomes what one would expect it to be.
how do i get rid of these strange decimals???
(formatting cells, setting number of significant figures does not work. i naturally already tried that)
I am trying to get the first column to float down as you scroll down the spreadsheet to fill in information. How do I get that going. I can't figure it out.
I use excel 08, computers viewing the files are 03.
I want to create a floating window in excel that can contain a series of macro buttons (12 total)
I'd like to see if this window can be opened with a hyperlink or a single macro button on a spread sheet.
I have a dataset that looks like this ....
View 9 Replies View Relatedis it possible to display the files open (the contents of the Windows drop down menu from standard toolbar) in a display that can be viewed at all times on a workstation. My reason for this is to monitor the files I have open to avoid trying to open a second copy and getting error reports from macros within. These error reports seem to frighten some of the users here and rather than read them and act accordingly they go for coffee and say thier system is down. It is my intention once I can get a system working, to introduce these people to monitor what they already have open, and more importantly what they do not need open at any particular time.
View 13 Replies View RelatedHOW TO SET FLOATING COMMAND BUTTONS in sheet which fixed at top or bottom of the screen not fixed at cells
means while scrolling a screen it should look like fix at bottom of the screen