Different Calculations For Different Data Types
Mar 8, 2012
As a complete novice....I want to:
1. Create a list of 3 different types of projects
2. Write three different types of calculations that should be undertaken dependent on the type of project. Each will be in a separate worksheet.
3. Make sure once I've checked the project type I apply the right calculations that match the project type
4. Summarise the results of the calculations against each of the projects
Can I do this just in excel or do I need to use macros?
View 9 Replies
ADVERTISEMENT
Sep 8, 2009
I have a problem concerning datatypes for an if-loop, the failure message tells me "Datatypes incompatible" for this code-line:
View 14 Replies
View Related
Apr 12, 2009
My question is about creating User-Defined Data Types. Is there ANY way possible i can create a User-Defined Data Type that declares a variable of another User-Defined Data Type instead of the Pre-Defined User Types like String, Integer, etc?
The following explains my problem in more detail.
I know to create a User-Defined Data Type at the top of the module before any procedures. Like this:
View 6 Replies
View Related
Apr 28, 2009
My question is about creating a hierarchy of Data Types.
I need to code 3 Data Types:
1.) MealPlan
2.) Meal
3.) MealItem
MealPlan represents a daily meal plan. It should have a certain number of meals. An example of MealPlan would be "Healthy" and have a total of 3 meals. Meal represents a single meal. It should have a certain number of meal items. An example of Meal would be "Meal 1" and have a total of 3 meal items. MealItem represents a single meal item. It should have a certain number of protein calories, fat calories, carb calories. An example of MealItem would be "Broccoli" and have protein calories of .2, carb calories of .8, fat calories of .1.
By using Data Types, I hope to create meal plans, which are made up of meals, which are made of meal items. The following code creates a Data Type hierarchy for two Data Types. I've examined it closely but i'm still having a hard time recreating it for my needs as stated above.
View 3 Replies
View Related
Jan 3, 2012
I have three items I would like to graph, on one chart. The first is %Complete. This is a number figure. The next is the date the item is due to ship. Obv, this is a Date. The third is today's date. Basically, I would like to display in the same chart so that we can see how far a long a project is, in relation with today's date and how much longer we have until it needs to ship.
This is the current display of the chart:
Is there a way to show the ship date, as the 100% complete mark? In order to make it display half-way decent, I had to format the left y-axis to go above 100%. I first tried to format the right y-axis, but was extremely confused to setting values. I figured out that the end date is somewhere in the 40,000 value mark? WTF is this about? Is 1 equal to 24 hours? I assumed that was the case, but then when I pick the value it should end with, it doesn't seem to react that way. I want the right axis to start with 12/01/2011 and end with 5/01/2012. How can I achieve this?
View 3 Replies
View Related
Sep 20, 2012
I have a csv file. When I open it by double clicking, all the finance figures appear as currency with the currency symbol. I can use the SUM function on these and it's perfect.
However, when I open this file using a macro, these same numbers look the same, except that they are now left justified and are text because the SUM function no longer works. If I select a range, I get the count of the number of items selected showing at the bottom of the screen but not the sum.
I have tried opening the file using the OpenText function which has several ways of setting a date format to the fields but nothing for numbers.
I have even tried, in the macro, selecting a cell with numeric 1 and then selecting the range and pasting the 1 as a multiply function but this doesn't work either.
View 2 Replies
View Related
Sep 19, 2008
I an newbie at VBA but I took some short programing classes back at my college days. I am trying to declare an array with different data types and since that seems to be imposible for what I gather then my other option is to declare what I remember as a structure.
View 9 Replies
View Related
Jul 18, 2009
In one excel book I have 2 sheets.
1. One sheet (request type wise) contains request type and the phase which it belongs to. eg request type A belongs to phase 1 and request type B belongs to phase 2. (like wise there are 212 request types divided into 8 phases)
2. The second sheet contains raw data (request type) where the request types are randomly arranged.
What I am trying to do is:
Compare the raw data of sheet 2 with standard data in sheet 1 and paste the phase to which it belongs to with a help of macro/code, since the standard data (212 request types with 8 phases) is huge.
View 9 Replies
View Related
Oct 12, 2007
Putting the final touches on a project I have and the last element doesn't work 100%. the scenario: I have a function that I wrote based on the user's input of the desired column to perform the operation. As a method of error-trapping and ease of use, I set instructions for the code to activate:
1) if the user highlights multiple cells of the desired column
2) enters the letter of the column (up to "z", not case sensitive)
3) enters the number of the column
Sub Button5_Click()
Dim ColumnUsed As Variant
' find number of columns selected
For MyColNum = 1 To Selection.Columns.Count
Cols = Cols + 1
Next MyColNum
'find number of rows selected
For MyRowNum = 1 To Selection.Rows.Count
Rows = Rows + 1
Next MyRowNum..............................
View 2 Replies
View Related
Feb 15, 2008
I often find that it would be useful to have a data type for geographic coordinates (i.e. latitudes and longitudes) that would e.g. permit/facilitate formatting negative values as South and West, direct subtraction of one latitude/longitude from another, conversion of degrees-minutes-seconds to decimal degrees, properly formatted axis labels when using Excel to draw maps (at the moment, I am editing the axis labels in the PostScript file by hand, when I don't use chart labeller to paste axis labels in) and so on.
(Time formats could be used, if only they could be prevented from converting hours over 24 to days, which I have not found out how to do.)
Therefore: does anyone know of any Add-In out there somewhere that could supply the lack of a geographic coordinate data type?
View 8 Replies
View Related
Nov 4, 2013
I have a non-contiguous range of cells that contains Values, Formulas, Text or Dates. In some cases a field containing a value could instead contain a formula depending on who is filling out the form and/or what information is known. For example, a cell might contain a value, i.e. Utilities, and I might either know the total ($76,310), or I might need to perform a calculation right in the cell to obtain the total (=54236+9587+12487).
My goal is to be able to copy the information contained in this non-contiguous range to the right some 52 columns (this is a safe temporary storage location) and then be able to copy it back should I need to.
One other problem may be that the source cell might be a merged cell.
Since I cannot determine whether the information is going to be a value or a formula, and I have some text and date formats to copy as well, is there some way to copy this range and keep the data regardless of format?
My Range might look like: (F4, C5, D6:D7, D9, D13:D15, D17:D18, D22:D25, D27:D30)
F4 is a date field, C5 is a merged cell holding text, D6 is the Utilities field described above. The other fields are all formatted as dollars or percentages.
View 7 Replies
View Related
Jul 21, 2014
I need to take data from spreadsheet Control Master.xlsx then apply calculations from another one Calculations.xlsx and record results to the first spreadsheet.Data to be taken from Control Master.xls columns C, D, E. After calculations results (Calculations.xls columns Q, R, S) to be recorded back to Control Master.xls columns F, G, H.
View 4 Replies
View Related
Mar 27, 2009
I have 2 sheets - one called 'Lookup' that has a table of recipes in the rows and ingredients in the columns. The cross reference of each is the required quantity of that ingredient, if any (obviously..). Both rows and columns are sorted alphabetically.
In the second sheet - Recipe - I have a subset of the recipes (e.g. 'Cakes') along with the applicable subset of ingredients. I've input these by hand, so I assume they can be referenced directly in the function. What I need to do is grab the quantity out of the table for each recipes ingredient. E.g. A6 will have the recipe 'Jamrolypoly' and H1 will have the ingredient 'Jam'. H6 needs to return the value from the table in Lookup.
I'm still (very) new to this but looking around I found the following which seemed to describe the function I am after:
=VLOOKUP(H1, Ingredients, MATCH(A6, Ingredients, 0))
(Ingredients is the name of the table in the Lookup sheet)
I then need to be able to use the returned values in separate equations on sheet 2 to work out costs. This bit I've done already but I've heard that some of the methods of data retrieval return 'N/A' if there is no value, and that would not allow any subsequent calculations using the value.
View 4 Replies
View Related
Mar 31, 2009
I have a huge database of textual files all of which have the same format - space separated text files. I need to find the average of the last column of all these files.
Each file is named uniquely. Is there an stress-free way to set up an automated procedure to go through each of these files automatically and to record the average of the last column along with the name of the file. I attached a few text files - these are daily prices of a few securities. The last column is Volume. I need to find and record the average of this column for each of these files.
The text files are here:
[url]
View 9 Replies
View Related
Nov 4, 2012
(Excel for Mac 2011). The size of my data means am crashing by usual methods of sorting - I need a formula for this rather than pivot tables.
I have a list of c. 40,000 rows. Col A is client name (largely different but some duplicates); Col B is Policy type (eg Home, Motor, Travel) and Col C is earnings on that policy (eg -60). An example would be:
Name
Policy Type
Earnings
Johnson
Home
[Code]...
So I need to figure out (via a formula) two things:
1) How to count duplicate names (eg appearing 3x = 1 customer; appearing 2x = 2 customers; appearing 1x = 1 customer)
2) How to build a simple table to show the relationship between policies. This would have Motor, Home, Travel, Motorcycle as columns and also as rows - the data would then be how many policies and in each cross point?
I have tried just working the data using Countifs etc, but as soon as I apply it to the whole data set the machine freezes, presumably due to its size
View 6 Replies
View Related
Sep 4, 2006
I have a program that calls the regress function multiple times (sometimes more than 1,000) per run. With each call to the regress function, a new workbook is automatically opened. For each new workbook opened, I am storing the contents in a workbook array called Models so I can later sort the workbooks based on the value of R squared. The program often has to open and store hundreds of workbooks before the sorting can take place so as to consider every possibility. Once the sorting has completed, I close all of the open workbooks except for the two containing the largest value of R squared. Due to the massive amounts of workbooks getting opened and then later closed, it takes about 30-40 minutes to run my program.
I want to know if after a new workbook has been opened and its value stored in the Models array, can I immediately close it and then later open only the 20-30 workbooks I really need to speed up run time? This way I wouldn't have hundreds of workbooks open at one time. Here's some code to help:
'This function will run regression stats for all possible combinations of models
'with choose variables
Private Sub Run_Stats( Combos, ByVal Size, R_Squared, Adj_R_Squared, Std_Dev, Cp_Stat, ByVal Dep_Var, ByVal NumIndepVar, ByVal Observations, ByVal Choose, Reg_Labels, ByVal Residual_Sum, Models)
View 9 Replies
View Related
Sep 22, 2006
I am having problems with calculations to be performed on date format. As in attached excel sheet, Start Date and End Date can be defined by the user. Once the user enters the dates, year 0 onwards are to be populated with values so that: (Also, not sure if I will need a button to initiate the calculations or a direct function will suffice)
year0 start = Start Date,
year0 end = (Start Date +12 months) or (End Date), if End Date is before (StartDate + 12)
year1 start = year0 end,
year1 end = (year0 end + 12 months) or (End Date), if End Date is before (year0 end +12)
year2 start = year1 end,
year2 end = (year1 end + 12 months) or (End Date), if End Date is before (year1 end +12)
year3 start = year2 end,
year3 end = (year2 end + 12 months) or (End Date), if End Date is before (year2 end +12)
year4 start = year3 end,
year4 end = (year3 end + 12 months) or (End Date), if End Date is before (year3 end +12)
year5 start = year4 end,
year5 end = End Date
If the dates are such that all years 0 to year 5 may not be covered, the years not used should be blank.
View 4 Replies
View Related
May 27, 2014
how to calculate averages and standard deviations based on different time periods without having to manually change the cells?
example:
1st average output at z3, 1st std dev output at z4
data to calculate from c3:c50
2nd average output at z5, 2nd std dev output at z6
data to calculate from c51:c98
3rd average output at z7, 3rd std dev output at z8
data to calculate from c99:c148
and it goes on based on this sequence. i would like to know how to do this without having to change the cells each time i want to calculate. basically what is the quickest way to calculate following this sequence?
View 6 Replies
View Related
Sep 5, 2013
I have built a model which has approx 33,000 different combinations (output) based on user selection. There are 15 different options for user selection which gives rise to the number of outputs (2^15 -1) = 32,767.
I have inbuilt a data table that gives the output for all of the 32,767 scenarios. However, it seems like for each change the calculations takes forever and I am not sure when the calculations are complete. Saving takes forever and stuffs up excel. The numbers keep changing in front of my eyes. The file is 10Mb big/small.
View 3 Replies
View Related
Feb 25, 2014
I'm looking to do some simple maths with ranges in Excel but I'd like a way to be able to input all these formulas automatically although I am pretty sure a single formula per column could do it all automatically. I've got to put the sums in AD to AF on the first line of each location, but the maths is for the entire location's range.
[URL]
View 3 Replies
View Related
May 23, 2014
I have a dataset that has a good number of duplicates, many of which have more than 2 records.
In these sets of duplicates, there are two fields that have many combinations of values.
I would like to find a way to COUNT THE COMBINATIONS in all of the sets of duplicates, as in, every time there is a type of a certain combination of values, create a count for it:
12345 9 9
12345 9 0
123456 9 9
123456 9 0
(Total: 2) For 9/9 and 9/0
12344567 0 0
12344567 0 0
12344567 0 0
12344567 0 0
12344567 0 0
12344567 0 0
(Total: 2) For 0/0 3x
I have attached a listing of types of combinations that I found by scanning the database, but I don't know what formula or functions would do the trick. I don't think there is something in Subtotal or the Count functionality that would apply but I will fumble around.
View 11 Replies
View Related
Sep 9, 2009
I need to find the total $ collected on repair orders that contain customer pay and warranty repairs. The problem is that C and W show up on differerent rows, if an RO has 4 lines 3 may be c and 1 line w. I don't know how to use pivit tables to get the info I am looking for, or if that is the best way to fnd my answer.
View 8 Replies
View Related
Jun 17, 2006
some of the functions in this file, and the problem is that I have one bug I can't fix.
There are four sheets. The first two sheets contain different types of scores.
The fourth sheet ranks each of the different types of scores on both first sheets. The third sheet reports out on the bottom five scores in each category. If one of the scores is missing, the whole thing gets screwed up.
I have attached the file and removed a some of the scores to illustrate.
View 9 Replies
View Related
Jun 23, 2008
I want to sum the values of two userform text boxes however I assume they are stored as strings so I get 1 + 2 = 12 - how do you convert strings to integers in VBA? It seems as though it's different to VB where you'd just use convert.toInt16() etc
View 9 Replies
View Related
Sep 5, 2008
I have portion of a macro that works when I specify a range like this:
ActiveChart.PlotArea.Select ActiveChart.SetSourceData Source:=Sheets(A).Range("O5:T41"), _ PlotBy:=xlColumnsEnd Sub
But I need one of the coordinates to be changeable on eacj round of the macro so I wrote this:
ActiveChart.PlotArea.Select ActiveChart.SetSourceData Source:=Sheets(A).Range(Cells(5, 15), Cells(B, 20)), _ PlotBy:=xlColumns
But when I executed the macro, it froze on this lines saying "Method of 'Cells' Global Failure. I need a way around this but I have no idea how at this point.
View 9 Replies
View Related
Aug 11, 2006
I want to have an array where each record contains a name and three numbers. My understanding is that Excel requires all element types within an array to be the same, and so I turned to a user-defined data type. But I don't seem to be able to create a dynamic array out of this type--when I try to ReDim Preserve it, I get an error saying that it's already defined. Can't I do that?
View 3 Replies
View Related
Apr 16, 2014
interpolating numbers in excel for an exponential function. I want to know how to be able to curve a curve in 4 different ways essentially the 2 that make up the two halves of a peak and the 2 that make up the two halves of a trough. I've tried using the LINEST function to create this interpolation and it's good to get 1 of the 4 curves I'm interested in. how to do the other 3? I'm also interested in knowing if these functions "whip the tail up" as in almost like how the tail end of a "sin" function flips back up. here it is.
[URL]
For this example of the exponential function, it creates the curve in one particular direction. I was wondering how I would do it to have it curve in another direction, for example I was testing the same function, but going downwards, and also having the tail curve back up (by hump I mean to simulate a gaussian distribution with the tails) how would I do that. seems like I now have part 1 of 4 aspects of the curve. here's the attached file to show what I mean. I want to get the hump going up and then sort of reflected along the y-axis and then similar features if I were to reflect the curves on the x axis. is it possible with the functions in excel? Linest test.xlsx
View 14 Replies
View Related
Dec 11, 2013
I am having trouble converting file formats. I would like to convert a.xlsx file to a .xls file. It is password protected and everything I have tried to use to convert the file has failed.
View 5 Replies
View Related
Apr 14, 2014
I would like to create a chart in vba which contains 2 sets of data, both using the same x axis. The first must be a line graph, the second a staggered bar chart. This must be represented on one chart with data labels. Also, how do I change the colour of the plots?
View 5 Replies
View Related
Nov 5, 2008
I have a procedure that was working perfectly yesterday. I've not changed it and yet today it doesn't seem to be working.
I keep getting a 'Runtime Error '13', Type Mismatch' debug error.
Public intRowCount As Integer
Sub mcrCopyDataNewSheet()
Dim strRawDataBook As String
Dim strNewBook As String
Dim strRawDataRange As String
intRowCount = Range(Range("B5"), Range("B5").End(xlDown)).Count
strRawDataBook = ActiveWorkbook.Name
strRawDataRange = Application.InputBox(Prompt:="Please enter the Raw Data Range beginning with Earliest Start on Sunday and ending with the Saturday Rota:", Default:="L:AR", Type:=8)
View 9 Replies
View Related