Mathematical Range Operations In VBA
Jun 2, 2006
I'm attempting to conditionally alter specific column range values based on the variable 'tagrow'. From the example you can see that if 'tagrow' is 7 or 8, I want to divide the values in column C by 1000 and put them in column D. If tagrow was different, I will use another conditional statement with a different denominator.
In the current code, I get a type mismatch error. I have also tried dividing by an equal size column range full of 1000's, with no luck (matrix math anyone?). All I want to do is manipulate ranges!
'Initializing tagrow so we can test what train we are trending'
tagrow = Cells(12, 2).Value
'Only Propylene flows need adjustment in A and B trains, calculate everything'
If tagrow = 7 Or tagrow = 8 Then
Sheet2.Calculate
Range("D15:D115").Value = Range("C15:C115").Value / 1000
End If
View 3 Replies
ADVERTISEMENT
Jul 20, 2006
How can i formulate the following in a formula:
Sales of product A (product A belongs to product class ABC) divided by the total sales of all products in product class ABC
View 9 Replies
View Related
Aug 19, 2013
What would be the correct mathematical terminology for the following:
I have a pool of 100 people and I am tracking their hours worked.
I want to present the % of people that fall in to the 3 largest categories
E.G.:
00:00 - 25:00 = 5
25:01 - 50:00 = 10
50:01 - 75:00 = 15
75:01 - 100:00 = 25
100:01 - 125:00 = 15
125:01 - 150:00 = 10
150:01 - 175:00 = 10
175:01 - 200:00 = 20
In this case the largest groups are:
50:01 - 75:00 = 15
75:01 - 100:00 = 25
100:01 - 125:00 = 15
55% fall in to this bracket.
What we are targeting as a business is that the majority of worker fall in to a similar range each month. So the challenge for my team is to increase the % value month on month. the close to 100% the better they are doing.
Equally what in Excel could I use to automate this calculation.
View 2 Replies
View Related
Jan 5, 2008
I am trying to write some code that will repair errors in a standard workbook. One of the errors is a blank cell that needs to be changed to "325¨¬F ¡Â T ¡Â 350¨¬F". How do I insert these symbols/operators into the VBA code?
View 6 Replies
View Related
Aug 11, 2014
I have an IF Function that I want to use to check mathematical errors between two sheets. For example Sheet2 is where I put all my material prices and Sheet1 cell A1 shows the total amount that is one Sheet2. On Sheet1, I have an IF Function in B1 that does the same calculation A1 does, but will display "ERROR" if A1 does not Match B1.
The IF Function works, my problem is that I want this to work from B1:B100 on Sheet1. But on Sheet2 the next SUM would be from row 42 to row 59.
How can I make and IF Function from B1:B100 on Sheet1 offset every 20 rows on Sheet2
For example:
Sheet1 B1 would be:
Formula:
[Code].....
Sheet1 B2 would be:
Formula:
[Code] ......
I need to do this without having to manually enter each range to sum up.
View 7 Replies
View Related
Mar 9, 2012
We have just been upgraded to Excel 2010 with it's hideous menus. tell me where to find =, +,-,* and / signs in the menus before I go mad!
View 6 Replies
View Related
Nov 13, 2012
I'm trying to take a vba function and add a second if clause. Here's the function:
VB:
Function getdes(DRng As Range, LURng As Range)
For Each ce In LURng
If ce.Value = DRn Then
holder = holder & ce.Offset(0, 2).Value & vbLf & ""
End If
Next ce
getdes = Left(holder, Len(holder) - 2)
End Function
I want to do something like:
VB:
Function getdes(DRng As Range, LURng As Range)
For Each ce In LURng
If ce.Value = DRn If ce.Offset (0,-02).Value = "y" Then
holder = holder & ce.Offset(0, 2).Value & vbLf & ""
End If
Next ce
getdes = Left(holder, Len(holder) - 2)
End Function
View 3 Replies
View Related
Jun 17, 2006
Does excel contain a format of : "number of months"?
Example : I have 3 cells
A1 : should contain the number of months (3 months)
A2 : should contain a date with this format (dd/mm/aaaa)
A3 : should contain A1+A2
View 4 Replies
View Related
Aug 16, 2008
I have "bashed into shape" a formula that involves 2 sets of parenthesis. After progressing beyond "#REF! or #NAME errors, Excel's automated Help suggested to add a comma, and the formula functions as wanted, I thought I was "Smart".
Later, when saving the formula to my `Formula Workbook', "Order of Operations" crossed my mind. - I think this formula is backwards, but `Excel Help' only suggested the addition of a comma? Maybe the all inclusive parenthes allowed the order to be understood?
The Formula: =AVERAGE((E56:AH56),COUNTIF(E56:AH56,">0"))
Q: Shouldn't the COUNTIF occur before the AVERAGE? Did the extra Parenthis automate the order of Operation within the Parenthis?
View 9 Replies
View Related
Mar 7, 2007
I need to have the contents of cell A1 (a 3 component list) control a formula in cell E1. If A1 is "add", then E1 should be B1 x D1. If A1 is "delete", then E1 should be B1 x D1 x .6, and if A1 is "delete ilo", then E1 should be B1 x D1 x (-1).
A1 B1 C1 D1 E1
list qty. list price of C1 item formula needed
( lookup)
View 5 Replies
View Related
Mar 5, 2014
I have a formula that looks like this:
=12*NETWORKDAYS(C2,D2)-12+IF(NETWORKDAYS(D2,D2),MEDIAN(MOD(D2,1)*24,6,18),18)-MEDIAN(NETWORKDAYS(C2,C2)*MOD(C2,1)*24,6,18)
This formula calculated the time between two dates (Start date in C2, End Date in C3) between the hours of 06:00 and 18:00 on weekdays. This is so I can work out how long an incident has spend within the group at the time when our service should be operating.
I was given this formula by someone on this forum a while back and i was new to excel and formulas so I just took it at face value since it worked. Now I want to disect it so I can use it in other situations where similar calculations are needed. I want to try to break it up into easier to understand chunks to try to understand what it is I need to change in order to do these related calculations.
NETWORKDAYS(D2,D2)
Is this trying to distinguish if D2 is a weekday?
MOD(D2,1)*24 Is this not the same as (1-D2)*24
NETWORKDAYS(C2,C2)*MOD(C2,1) Is this not the same as: IF(weekday(C2)>5,(C2-1)*7,0)
IF(NETWORKDAYS(D2,D2),....,....) What is the comparison here? if NETWORKDAYS(D2,D2) = 0 or 1?
Is this equivalent?
=12*(
NETWORKDAYS(C2,D2)-12
+IF(NETWORKDAYS(D2,D2),MEDIAN(MOD(D2,1)*24,6,18),18)
-MEDIAN(NETWORKDAYS(C2,C2)*MOD(C2,1)*24,6,18)
)
View 1 Replies
View Related
Jun 22, 2009
I'm try to put together a set of macros that perform certain operations within a file. However I've got a bit stuck on the following, and I can't see where I've gone wrong:
View 3 Replies
View Related
Jul 28, 2007
I want to copy several separate sections on a worksheet and place these sequentially in an array, then paste these in order into another worksheet.
I have written a macro to copy and paste between the two spreadsheets, however, this is rather basic as it involves straddling between the two and performing multiple alternate copy and paste operations, as only one section can be copied at any one time.
View 9 Replies
View Related
Jan 16, 2009
I am trying to write a formula in 2003. The basic premise is below and I'm having problems getting all the senarios to work out.
Cells:
E20 = Calc'ed amount
E22 = Min amount (Sometimes equals zero - No Min)
E23 = Max amount (Sometimes equals zero - No Max)
E24 = Additional amount to add
=IF(AND(E22=0,E23=0),SUM(E20,E24),IF(AND(E220,E230),IF(AND(E20>E22,E20E23,SUM(E23,E24),IF(AND(E20E22),SUM(E20,E24),IF(AND(E20
View 9 Replies
View Related
Oct 17, 2008
I am trying to make things easier for the next user by having one command button run the macros for the other worksheets (so they don't have to switch between worksheet)
However,
I get "Runtime error '1004' Application-defined or object-defined error"
View 8 Replies
View Related
Mar 30, 2007
I need a macro that will perform a set of oprations on all worksheets in a workbook. The names and number of worksheets will not always be the same. I have found several macros that look like they will do this, but when I try to add my code they don't seem to work.
View 9 Replies
View Related
Jul 18, 2007
I need to create a spread sheet that in Col A has 3 variables, each of which I need to triger 1)fill of that row, 2)different formula's in different columns within that row. Is this possible in excel?
View 9 Replies
View Related
Aug 8, 2007
To speed up copy and paste operations in a macro, I've heard that one can replace the following:
Sheet1.Range("A1:A200").Copy
Sheet2.Range("B1").pasteSpecial
with
Sheet2.Range("B1:B200").Value= Sheet1.Range("A1:A200").Value
The second code should run faster as the clipboard is not used to store the copied info.
When I tried this, though, I didn't notice any improvement in macro running speed.
View 9 Replies
View Related
Feb 2, 2007
I have a series of operations to carry out and, while I can do the code for each individual one, how to declare the variables correctly and have the operations done in a series of Do/ Loops or For/Nexts. Especially the declaring of named ranges as variables. Also a bit uncertain of the best way to find and coy the match. I have attached a simplified version of the workbook, with explanations on it.
Basically what I need to do is loop through a series of named ranges and then loop through the names in each, match each name with a name in a master list (with a flag as an image), add an e-mail hyperlink to that flagged name and copy both to a new cell.
View 2 Replies
View Related
Oct 22, 2008
In cell C2 I want to compute the value of 5x^6 + SQRT of 6, where the value of x is located in cell A%. What formula would I need to enter into cell C2 to do this?
View 9 Replies
View Related
Dec 30, 2008
when i copy columns resulted from another columns operations and paste in new sheet i got garbage ,could you tell me why and how to overcome this problem.
View 2 Replies
View Related
May 22, 2006
Does excel contain a format of just : "number of days"??
For example : I have 3 cells
A1 : should contain the number 30 (30 days)
A2 : should contain a date with this format (jj/mm/aaaa hh:mm)
A3 : should contain A1+A2
View 3 Replies
View Related
May 24, 2006
(Date1-Date2) : what's the format I should use to obtain the result in number of days.
For example :
(23/12/2006 16:30:00) - (18/11/2006 15:30:00) : It should give 35 days 1 Hour (35:01:00:00 - dd:hh:mm:ss)
How can I have this format (dd:hh:mm:ss)
View 9 Replies
View Related
Mar 16, 2013
Trying to assign code to comm. button on User form to copy lets say:
(sheet1, rangeB2:B21) to (sheet2, first blank row rangeB2:B21) and paste it as text value one more question: what to be aware in case of sheets format (merged cells, hidden rows...)
View 4 Replies
View Related
Oct 7, 2009
Need a code using application.inputbox to get a range, then use that range to copy and paste the range's link and format to a different sheet? The specifics don't matter, I just can't figure out the syntax. Here is what I have currently:
View 2 Replies
View Related
Jan 6, 2010
I'm trying to select a range that will be changing by column. I'm not sure why my syntax isn't working. What I've got:
View 2 Replies
View Related
Aug 6, 2013
I need method, using a button, that looks at a cell--say EO2, for example--, looks back on a master worksheet at a specified row and range for a match, then looks at the information from a specified range below the matching cell (The information in this column will either be blank or have an "X" in the cell), and then those rows that do not have an "X" will be hidden in the corresponding rows in the working worksheet. Therefore, if at any time the value in "EO2" ever changes, then it will automatically find a new match and repopulate and hide information as before. About 130 columns will have its own button so that a "query" can be made that depends on the information in a particular cell in that column.
The master worksheet now has matrix of 287 rows and 58 columns. Each row is for an operating procedure and each column shows a job code. An "X" in a coordinate cell for a column/row shows whether that job code is responsible for knowing that operating procedure. So, on the working sheet, an employee's primary job code is given underneath his or her name. When the button is pushed, all the operating procedures not required for a given person will be hidden and only the required ones will remain visible--grouped, if you will. Qualification dates will be easier to see now that the information is consolidated. Whenever someone transfers to a new position, a new code will be inputed on the working sheet. When the button is pushed, a new grouping will result. Any operating instructions that overlap will still have qualification dates, so that information will not need to be transcribed.
View 9 Replies
View Related
Feb 7, 2014
I am working in excel 2010. I have a tracking document that lists free tickets and their expiry dates. In the adjacent columns we track redemption details of these free tickets. What I want to do is return the oldest expiration date from A only if the ticket has not been used (i.e. B is empty). This will allow me to see the date the upcoming tickets about to expire so we can make sure they are used.
A________________B
Expiry Date________Redeemed by
15/08/2014
15/02/2014
15/08/2014________John
15/02/2010________Marc
15/02/2011________Bob
View 4 Replies
View Related
Sep 8, 2009
I’m trying to use the SUMIFS function in Excel 2007 to evaluate the following formula:
{=SUMIFS(range to sum, range to evaluate, evaluation criterion)}
The range to sum is A1:A10, the range (dates) to evaluate are in B1:B10, and the evaluation criterion is that the date is before 31/10/1999.
So my formula looks like this:
{=SUMIFS(A1:A10,B1:B10,”<31/10/1999”)}
This works fine, but how do I refer the 3rd argument in the function to a date in a particular cell rather than typing in the date specifically?
View 2 Replies
View Related
Jan 27, 2013
I am trying to automate a process where a series of numbers would get populated according the range values. Also I am trying to get the automation to pick up the next range when finished with first one and continue with the task.
Here's what I have as start info and where I want to get to.
Sheet1
A
B
1
Ranges
[Code] ......
Excel 2003
View 2 Replies
View Related