IF Formula For Sets Of Variables
Jan 28, 2009
If a value fallw within these ranges, then the next cell should calculate the answer according to the percentages outlined.
for exmaple:
If somethng costs 250.00 then the next cell should display - 250 x .50 and the answer would be 375.00
1-500 = 50%
501-1500 = 45%
1501 - 1600 = 40%
1601 - 2500 = 35%
2501+ = 30%
and automatically calculate the answer.
I know there's an IF formula, but I can't seem to figure out how to do multiple IF's ~
View 5 Replies
ADVERTISEMENT
Apr 10, 2008
Below is a series of sets. Column A is the set number. I need a macro that will insert a row between sets and then put a border around each set. In my spreadsheet the sets are from A1:C500. Sometimes the sets are only 1 row, sometimes multiple rows. It looks like I will be doing one of these sheets every week. So far I have been doing it manually, but a macro sure would save some time.
View 13 Replies
View Related
May 12, 2014
I posted an earlier question about using a countif formula with two sets of criteria, Below is the formula I was given but for the life of me I can not get it to calculate. I have created a drop down box for each agent at my work and a drop down box for pass and fail. I want to keep a running total if they pass or fail on an assigment. I have labeled my worksheet phone.
=sumproduct((Phone!G:G="Fail*")*(Phone!B:B="Smith, John*"))
View 2 Replies
View Related
May 22, 2014
Any formula for removing text within multiple sets of parentheses?
I would like to take something like this: Compared with placebo, dimethyl fumarate was shown to be effective in the treatment of patients with MS in the phase 3 DEFINE (Gold R et al. N Engl J Med. 2012; 367:1098-1107) and CONFIRM (Fox R et al. N Engl J Med. 2012;367:1087-1097) trials. Common adverse effects associated with dimethyl fumarate that were observed in these trials included flushing and GI events, as well as decreased lymphocyte counts and elevated liver aminotransferase levels.
and have it read: Compared with placebo, dimethyl fumarate was shown to be effective in the treatment of patients with MS in the phase 3 DEFINE and CONFIRM trials. Common adverse effects associated with dimethyl fumarate that were observed in these trials included flushing and GI events, as well as decreased lymphocyte counts and elevated liver aminotransferase levels.
I wish to automate this task so formulas (if possible) are preferred. Totally cool with a multi-formula, many-columned solution - as long as this task is automated.
NB: Each cell will contain different text, so the sets of parentheses will appear in different places. The number of parenthetical sets may also vary from 1-5.
View 9 Replies
View Related
Sep 29, 2011
I want to have formula with: ActiveCell:formula = I want to sum columns in a row having a column variable called: col The col variable will be the far right column and the other colunm in Row 2 will be col-3. What is the syntax to create this formula? If col = 5, formula normally would be :sum(b2:c5), I want to use col as the varialbe.
View 3 Replies
View Related
Oct 24, 2013
Just got a problem with auto-populating cells with a formula that is made up of variables. My formula references the cells on another sheet, but this will be dynamic.
I'm trying to get the formula to reference e.g. cell A1 in the Calls Taken sheet, with the column held in the srtshortname variable and the row held in the formularow variable.
Code:
set rng = range(cells(introwdate, formulacol), cells(introwdate, formulacol))
rng.formula = "='Calls Taken'!" & strshortname & "" & formularow & ""
View 2 Replies
View Related
Nov 25, 2013
Writing a formula for the info below. Here is what I need basically. If B2>2, then I need it to count all central and field, STK and NSTK in column D.
location
days
stock type
Central
3
nstk
field
1
stk
[Code] ...........
View 9 Replies
View Related
Dec 3, 2007
I think I'm using the correct terminology with the term "variable", but to explain what I'm trying to do, I want to get RAND() to hold the first returned variable so I can compare it to other places RAND() has been used & if the returned value is the same as the other place, then run RAND() again.
Here is my basic formula (where $B$2 is 50):
=IF(ROUND(RAND()*$B$2, 0)+1=A4, ROUND(RAND()*$B$2, 0)+1, ROUND(RAND()*$B$2, 0)+1)
I'm trying to say in the formula above that if rand = what was already in A4 then run random again -- but this doesn't keep if from returning the same value as A4 on the second pass.
What would work is something like (where X is the assigned variable):
=IF(X=ROUND(RAND()*$B$2, 0)+1=A4, ROUND(RAND()*$B$2, 0)+1, X)
But it doesn't appear you can use X in a formula (only in a macro which I don't want to use) --
View 9 Replies
View Related
May 11, 2014
Is it possible to find the formula of a result that is based on three other values.
Here's my example:
I give three cases, but I am sure all three use the same formula. I made the team names up but the values are 'real'.
MATCHES
TEAM NAME
TEAM RATING
OPP. RATING
POINTS DIFF.
NEW RATING
Match1
Blumps
-2.62
5.05
8
-1.28
Match2
Champs
2.8
4.08
-18
2.37
Match3
Sharps
8.26
-3.53
-16
3.68
I want to know what formula was used to calculate the New Rating in the last column. I am not 100% sure if the formula to calculate the New Ratings as shown above includes a value for home ground advantage of which I might be unaware. For what its worth, the Blumps and Sharps were home teams and the Champs was a visiting team for the three matches shown.
View 1 Replies
View Related
Jul 27, 2009
In column H: =IF(ISERROR(L4-J4-K4),"",IF(OR(K4="0", K4=""), L4-J4, L4-J4-K4))
So, if formula is going to come up with an error, I don't need to know. If it's not an error: L - J - K. Except that sometimes there isn't information in J or K, and the formula won't calcluate L - 0 - 0, unless I physically enter in zeros.
=IF(ISERROR(L4-J4-K4),"",IF(K4=""), L4-J4, L4-J4-K4))
and
=IF(ISERROR(L4-J4-K4),"", L4-J4-K4))
I don't want the people using this to have to enter in a plethora of zeros in order to force the calculation. What am I doing wrong? I've attached workbook with the relevant information in it. You can see in the middle that if there is nothing entered, it won't work right.
View 5 Replies
View Related
Dec 3, 2003
correctly using variables within functions used in formulas specified by VBA. Here's an example:
I want to place a formula within a workbook file called "Books 2003.xls" that goes to the version of the file for the previous year (or whatever year is specified) and does a Sum of a particular range (where that range is also specified as a variable) so it sums up the Total for the previous year for the same number of months that have data in them to date for the current year. Once VBA places the formula where it belongs, it should be able to always provide a running comparisson with the current year to date total and the totals for the same period for the previous year. Here's an example of the intent of this simple formula:
ActiveCell.FormulaR1C1 = "=SUM('[Books 2002.xls]Income Summary'!R4C2:R8C2)"
The workbook files will all be named the same way: Books 2002.xls, Books 2003.xls etc.... The range to be summed will always start at R4C2, but could then end anywhere from R4C2 (same as B4) up to R15C2 (same as B15).
I already have a routine that captures the value for the variable CurrentYear in the form "2003" and thus have another variable for PrevYear (= CurrentYear -1), and so then have a way to correctly specify the variable "BookName" to get the correct filename needed. I also have a variable for the CurrentMonth in the form of "1 through 12", and can use that to specifiy the correct RowNum needed to determine the end of the range (RowNum = CurrentMonth + 3).
I've tried to substitute the variables "BookName" and "RowNum" into the above formula with various combinations such as what follows, but I'm not getting the correct syntax with the right number of quotes etc...:
ActiveCell.FormulaR1C1 = ""=SUM('[" & BookName & "]Income Summary'!R4C2:R" & RowNum & "C2)""
This doesn't work, and I'd love to learn the correct rules for syntax when inserting variables into situations like this.
View 4 Replies
View Related
Dec 19, 2013
I have a spread sheet that has various references
on the same sheet
on a different sheet ( in same workbook )
on a different sheet ( in a different workbook )
If I click on a example cell it might say
Code:
=5*C4*$D$1-Sheet1!C9
Is there a way for excel to be able to iterate through these separate variables ? and know if the reference is on the same sheet ?
Say I wanted to evaluate the references on other sheets ( replacing the link with the value )
So if Sheet1!C9 contained the value 10 the formula would be replaced with
Code:
=5*C4*$D$1-10
View 2 Replies
View Related
May 12, 2014
I can't quite get this formula to give me the correct value.
imgur: the simple image sharer
I tried defining as a Range and I can't get it to work right either way. When I hover over my r1 and r2 values the range is correct but it does have "$A$227:$A$447" quotes around the range so I think that is messing me up.
View 4 Replies
View Related
Dec 1, 2006
I have written some VBA code that is functional, but yields a formula that is somewhat confusing to the user.
I have two string variables called TippityTop and Anchor, both of which refer to specific cell addresses in the R1C1 style.
I attempted to define other variables that reference cells that are offset from TippityTop and Anchor without using the ActiveCell route. Try as I might, I could not produce the cell addresses that I wanted these new variables to reference.
I consulted many Excel Help screens and referred to a book on Excel VBA, but I finally took another route.
I now have:
ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNA(MATCH(RC[-2],OFFSET(" & TippityTop & ",1,-2):OFFSET(" & Anchor & ",-2,-2),0)>0),ROUND(RC[-1],2)0),""DOV not in Treasury"","""")"
The problem is that this code yields this formula in Excel:
=IF(AND(ISNA(MATCH(L587,OFFSET($H$585,1,-2):OFFSET($H$798,-2,-2),0)>0),ROUND(M587,2)0),"DOV not in Treasury","")
Rather than OFFSET($H$585,1,-2):OFFSET($H$798,-2,-2), I would like the formula to say F586:F796, so that the end user can easily understand the logic.
View 9 Replies
View Related
Jan 15, 2009
I want to assign a cell a formula that changes base on variable, example
myVar=3
Cell(1,1).value = "=average(1:{myVar})"
what do i do to make this work instead of {myVar}?
View 9 Replies
View Related
Sep 4, 2007
I am using follwoing vb code to enter formula to sum a range. However it is giving sum of different range.
Cells(Row, Column).FormulaR1C1 = "=SUM(R[" & a & "]C[" & b & "]:R[" & x & "]C[" & y & "])"
Where a, b , x and y are variables containg starting row, starting column, last row and last column value like a=19; b=3; x=24 and y=3. When i check the formula in that cell, it appears as Sum(F25:F30)
View 3 Replies
View Related
May 14, 2008
I am creating a worksheet and I have a formlua where the value is text. I can make it work standing alone but not with other variables. =IF(E11=S1,0)+(IF(E12=S1,0)+(IF(E13=S1,0.0025))+IF(E14=S1,"Call for Prciing"))
View 2 Replies
View Related
May 5, 2014
Basically I need a formula that takes into effect many variables. It needs to check a size, thickness, and material, to determine a cost...
1.5 O.D. - 16GA - 304SS = $X
but
1.5 O.D. - 18 GA - 304SS = $Y
and such.
The problem I have is not only am I not understanding a lot of Excel jargon, the data set is not in perfect "example" conditions.
O.D. is in N:N yet there are blanks between N(x) and N(y), GA is in O:O yet blanks between O(a) and O(b), and so on.
Here is what I have at the moment, it uses a second sheet to derive the cost based on the parameters. Please ignore the first few terms, they are used with this cost lookup to give me my final. There also may be incorrect syntax in this, but since I get a nesting error first, I really don't know.
=V7+(Q7*M7*(IF(N7=2=AND(O7=20)=AND(L7=304),’Steel Tube Cost WIP’!$DD$19,IF(N7=2=AND(O7=20)=AND(L7=316),’SteelTubeCostWIP’!$DD$20,IF(N7=2=AND(O7=20)=AND(L7=2205),
’SteelTubeCostWIP’!$DD$21,IF(N7=2=AND(O7=18)=AND(L7=304),’Steel Tube Cost WIP’!$DD$16,IF(N7=2=AND(O7=18)=AND(L7=316),’SteelTubeCostWIP’!$DD$17,IF(N7=2=AND(O7=18)=AND(L7=2205),
’SteelTubeCostWIP’!$DD$18,IF(N7=2=AND(O7=16)=AND(L7=304),’Steel Tube Cost
[Code] ......
Mentioning LOOKUP, can I even use it? I've attempted many times however it isn't going too well What can I do?
View 2 Replies
View Related
Dec 19, 2012
I've tried this in formulas (if, if/and, if/vlookup, if/vlookup/and) and I've been trying to write a macro for this (which I'm thinking needs to loop).
Problem: I have a report that is broken into three categories.
Column A includes locations, Column B includes vendors. Across the top, the monthly report is broken into four classifications (trans types), which are then further subdivided by quantity and cost. (Rough estimation is provided below)
Locations
Vendor
Z53
Z50
Z51
Z52
[code]....
My data comes in sorted by location, and subtotaled by vendor and trans type. So I'll have a row of data that includes:
Location 1, Vendor A, Z51, $200, 2
Location 1, Vendor A, Z53, $150, 2
Location 1, Vendor B, Z53, $150, 1
...
What I need to do is pull the data for Z53 based on Location & Vendor. So from the data is would read Location 1 & Vendor A and then find them on the report and paste into the appropriate row (in my report Z53 qty is col E and $ is col F).
I was trying to do a macro that within a determined range (finding the first and last instance of Z53) would match location and vendor to the monthly report and paste the values of Qty and $ into the appropriate fields. Below is what I managed to mangle:
Code:
Dim Holder1 As Range
Dim Holder2 As Range
Dim Holder3 As Range
Dim Holder4 As Range
Dim Found As Range
Dim y As Range
Dim x As Range
Dim Z0 As Range
[code]......
I was originally trying to match from the report to the data and then copy back to the report, but I had the idea of instead taking the location and vendor from the data and finding the match on the report and pasting. That way I wouldn't have to worry about errors (unless a new location was added that was not included on the report - which I think is an easier fix than trying to go the other way, but maybe not).
View 9 Replies
View Related
Jun 6, 2007
I have three variables; Independent variables x & y, and dependent variable z. x & y can take the values 1,2,3 and can equal each other z can also take on values 1,2,3 but can never equal x or y. I tried using if/and statements to solve this (see below), but I would have to do it for each case and it exceeds Excels embedded function limit.
=If(and(B7=1,B10=1),riskduniform(E4:E5),if(and(B7=1,B10=2),3,if(and(B7=1,B10=3),2,if(and(B7=2,B10=2),riskduniform(1,3),if(and(B7=2,B10=1),3,if(and(B7=2,B10=1),3,if(and(B7=3,B10=3),riskduniform(1,2),if(and(B7=3,B10=1),2,if(and(B7=3,B10=2),1)))))))))
View 3 Replies
View Related
Jun 20, 2008
I want the range in the VLOOKUP below to display its actual value - ie "'6 June 08'!$A:$C" in the formula rather than the actual variable name 'strResult'.
Sub PreviousCount()
strDate = "6 June 08"
strColumnRange = "$A:$C"
strResult = "='" & strDate & "'!" & strColumnRange
Dim i As Long
i = Range("A2"). CurrentRegion.Rows.Count
Range("D2:D" & i).FormulaR1C1 = "=IF(RC[-3]="""", ""Column A blank!"", IF(ISNA(VLOOKUP(RC[-3],strResult,3,0)), ""NEW INSTALL"", VLOOKUP(RC[-3],strResult,3,0)))"
End Sub
View 4 Replies
View Related
Feb 5, 2009
Unzip Code - Works without Variables, Breaks with Variables.... This has been driving me bananas...
I have the
View 2 Replies
View Related
Jun 4, 2014
I have a drop down list in a column called Report Type (example below).
Report Type - Drop-Down Menu in Column F
Business/Operational/Work Plan
Budget Report
Performance Report
Program Quarterly Report
Program Mid-Year Report
Program Annual/Year-End/Final Report
Service Quarterly Report
Service Mid-Year Report
Service Annual/Year-End/Final Report
Financial Quarterly Report
Financial Mid-Year Report
Financial Annual/Year-End Report
Auditied Financial Statements
In-Year Reallocation
Annual Reconciliation Report
SRI Report
Other Report
I need to count all the cells that have: Budget Report, Financial Quarterly Report, Financial Mid-Year Report, Financial Annual/Year-End Report, Audited Financial Statements, In-year Reallocation, and Annual Reconciliation Report
Is this possible with a countif formula?
View 4 Replies
View Related
Apr 20, 2012
I am trying to create an active cell formula based of variables from given cells.
With ActiveCell.FormulaR1C1 = "=CONCATENATE(""RU"",RC[-12],RC[-11],RC[-10],RC[-9])-CONCATENATE(""MU"",RC[-12],RC[-11],RC[-10],RC[-9])"
ActiveCell.Formula = ActiveCell.Value
But This does nothing.
View 5 Replies
View Related
May 22, 2008
I would like to use a varible Cell for the following forumula:
ActiveCell.Formula = "= ROUND(PIExpDat(""TimeEq('""&Cells(RowNdxG,4)&F$2,F$3,F$4,F$5,0,)/3600,1)"
I have underlined the variable. This is not working but is rather showing up as a string value Cells(RowNdxG, 4).
View 6 Replies
View Related
Dec 28, 2012
In my worksheet, I know the last line of my report AND I know how many "reporting segments" (all equidistant and identical) there are in the report based on the last row using the below (which I tested in several reports in messages):
VB:
Dim vListEnd As Variant
Dim vTaskCount As Double
vListEnd = ActiveSheet.Range("A1").Offset(Sheet1.Rows.Count - 1, 0).End(xlUp).Row
vTaskCount = ((vListEnd - 5) / 22)
My "reporting segments" are ALWAYS 22 rows each and the first one always starts in row 5. Example: A document where the last row (containing an End of Report special character) is 247 would have 11 reporting segments.
Within each reporting segment, there are two different formulas needed.
For the first reporting segment located in rows A5 thru J27:
I need FORMULA1 in all cells of the range (D5:D15 dragged out to H5:H10(not 15) and D18) and FORMULA2 in cells (F20:F22,J20:J22).
Then I need to repeat that vTaskCount number of times (number of segments) and at intervals of 22 (segment repeater offset). Some reports may have 2 segments, some might have 50, but the structure is always identical.
My formulas are all pretty simple if it makes a difference (originally using FormulaR1C1 = "=RC[-1]+RC[-3]" --- but because I now know solid cell locations I suppose I don't need to make them relative, too.)
View 2 Replies
View Related
Sep 30, 2013
Is there a way that formula links in spreadsheets can use environment variables to reference formulas in other spreadsheets/addins?
For example, I have a spreadsheet that imports templates which call functions in an addin. The spreadsheet, templates and the addin could be installed into either the 'Program Files' or the 'Program Files (x86)' folders.
I am experiencing issues with the formula references when moved between 32 and 64 bit computers since Excel seems to store the full path of the addin in the Excel formula (even though it hides it when the reference resolves its path) in my templates. I would like to update the references in my templates so that they use an environment variable (set by my software installer) to always know the correct path of the addin.
In Excel 2003, spreadsheet links are edited via: 'Edit'->'Links'
In Excel 2007 and higher,'Data'->'Edit Links'
View 1 Replies
View Related
Jul 27, 2006
Can a Function give two or more output variables. e.g.
Sub a()
x = 5
result = Y(x)
End Sub
Function Y (x As Integer) As Integer
Dim B
B = ... * x
Y = ... * B
this will give back Y as a result. But if I want to get 2 or more output variables (let's say I need to get also B into sub) from one function, how should I do that?
I need this because function works with large matrix and I want to extract some values appeared in between.
View 2 Replies
View Related
Jan 27, 2014
In a macro I want to automatically insert a formula in several cells. The formula depends on other cells, and I want to be able to manipulate these cells with variables. Here is my code:
[Code] .....
All my variables are declared:
Sheets("DATOS YTD 2014").Cells(I, Semana + 1) is the cell I want to be able to chose due to the variables
Sheets("DATOS YTD 2014").Cells(I, 3) is the reference cell for the VLOOKUP formula, that will vary with I
SheetMonth.Range("B3:W172") is a range in the sheet SheetMonth which is fixed
The error message I receive is the following: "Run-time error 13, Type mismatch"
I precise that the next step is to make the ",6," part in the vlookup formula also variable... but I guess once my current issue is solved this one will be a piece of cake.
View 3 Replies
View Related
Apr 27, 2006
I'm trying to loop through a range in excel from access, checking where the titles (in Excel row 1) match with the fields (in a recordset in Access that is passed to the function) - and where they do, I want to dimension a variable to hold the column number - I'm not sure it's possible, but I'd be interested to know either way. The line I'm asking about is at the bottom of the code - the rest of the code is just to give context...
Sub ImportGeneric(rsImported As ADODB.Recordset, rsConfirmed As ADODB.Recordset)
Dim fd As FileDialog
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Worksheet
Dim iFilePicked As Integer
Dim strFilePath As String
fd.Filters.clear
fd.Filters.Add "Excel files", "*.xls"
fd.ButtonName = "Select"
iFilePicked = fd.Show
If iFilePicked = -1 Then
strFilePath = fd.SelectedItems(1)
Else ..................
View 3 Replies
View Related