Return Function As An Argument
Jan 23, 2008
When I try a MATCH function, I substituted the range through the ADDRESS function. But, it returns #VALUE error. When I manually typed the same range address, it produces the results. I've been behind this more than 8 hours still I can resist the heat on my cool head! But, I thought you coolest head guys need some heat to warm up for to-day's challenge.
View 9 Replies
ADVERTISEMENT
Sep 25, 2008
how to create a function argument containing my own defined formula?
View 9 Replies
View Related
May 23, 2008
formula to calculate the commission based on 9 cases each case is subjected to 4 differant arguments.
here is the formula for the first case (the answer if true 1.4) & the last case( if all the casses are fails it should show 0.6) u will find it in cell K5
=IF(AND(E5>=20,H5=1,I5>=80,J5>=80),1.4,0.6)
this is only 1 case HOW can i calculate it basd on 9 casses??
View 10 Replies
View Related
Sep 16, 2009
I have an attached file and I am trying to build a VBA function to calculate total values. First row is "RollingTime" and for example if I am trying to calculate the "Total" value. For "RollingTime" = 2 it should be
RollingTime(2)*Percentage(2)+RollingTime (1)*(1-Percentage(1))*Percentage(2)+RollingTime(0)*(1-Percentage(0)*(1-Percentage(1))*Percentage(2)
Which is 109732508*0,3 + 1017508995*(1-0,2)*0,3+1587172158*(1-0,1)*(1-0,2)*0,3
And here is the code I have tried to produce:
View 10 Replies
View Related
Sep 12, 2006
In the code bellow I would like to automate a if function until the 1st emptycell in the row 7 of my spreadsheet.
In my IF function, I would like to refer to a fix cell ("B1") while the other argument is in the same column as the function but two rows bellow.
My problem is that I don't figure out how to refer to a fix cell with the syntax I would like to use t run the macro.
I think it's more clear when you'll see the code
Sub Face2face()
Range("B5").Activate
Do
If ActiveCell.FormulaR1C1="=If(R[2]C>=Range("B2"),Range("B2"),R[2]C)"
ActiveCell.Offset(0, 1).Select
Loop Until IsEmpty(ActiveCell.Offset(-1, 0))
End Sub
View 8 Replies
View Related
Jun 25, 2013
When I step-through my code below, it always opens the first file in the directory "C:Pyramid Files", but when it comes back to the Pyramid Files sub after fully processing the first file via various other subs, the VB Editor apparently doesn't like something about this line: StrFile = Dir(), since it quits after "snapping-back" to the previous sub Initialize(). I have also tried StrFile = Dir, but that doesn't work either. I did Dim Strfile in the General Declarations. When I set Watches for Dir and Dir(), I get the value "Invalid procedure call or argument" for both, as if the directory function lost the value. I can't determine why this is happening.
VB:
Dim WSM As Worksheet, WSB As Worksheet, WS1 As Worksheet, [U]StrFile As String[/U], StrDirectory As String, ClientCode As String
Dim Filename As String, LastRowb As Long, LastColB As Integer, LastRow1 As Integer, NextRowC As Integer, x As Integer, y As Integer
[Code] .......
View 4 Replies
View Related
Feb 26, 2014
Need to use CountIFs formula to evaluate multiple conditions in the same column. Here is the formula I tried. It works for Resolved but returns 0 when i try to add Duplicate.
=COUNTIFS('P12 Source'!H:H,A18,'P12 Source'!F:F,"Resolved,duplicate")
Also used this formula with success by referencing a cell that had "Resolved" in it but when I tried to add another cell with "Duplicate" it again returned 0.
=COUNTIFS('P12 Source'!$H:$H,A19,'P12 Source'!$F:$F,'P12 Source'!$F$75)
View 8 Replies
View Related
Dec 3, 2012
I have the following problem: I have this formula, that works correctly:
=SOMMA.SE('[myfile_12112012.xlsx]RIEPILOGO'!$C$2:$C$12;E1;'[myfile_12112012.xlsx]RIEPILOGO'!$B$2:$B$12)
I wish I could read the name of the file (myfile_12112012.xlsx) or, alternatively, all of the function's first argument (('[myfile_12112012.xlsx]RIEPILOGO'!$C$2:$C$12) from a separate cell.
I tried this:
SOMMA.SE = (C2, E1, '[myfile_12112012.xlsx] ERROR SUMMARY'! $ B $ 2: $ B $ 12)
putting in the cell C2 the string:
'[myfile_12112012.xlsx]RIEPILOGO'!$C$2:$C$12
In this way, however, the formula does not work.
How can I read and evaluate correctly the first argument from the cell c2?
View 2 Replies
View Related
May 6, 2009
I have made my own excel function that my users needs every day. it works just fine, however if you do not know the required argument for this function, you couldn't use it. How can i prompt my users for the right order of the argument when they type the function in excel?. example is when you type the Function "=left(" you will be prompted by excel of the correct arguments.
View 3 Replies
View Related
Jun 27, 2006
I have a function in a cell triggered on the value returned by a DDE link in another cell.
e.g. cell A1 contains =function1(A2) and cell A2 contains
=ADVFN|NYSE_CAT!CUR
function1 is triggered each time the DDE link updates regardless of whether the result returned has changed or not. How do I prevent function1 being triggered if the returned value has not changed?
View 9 Replies
View Related
Aug 30, 2012
This error message in line vpp:
Invalid procedure call or argument
Code:
Function fn1(ByVal a, ByVal i, ByVal e, ByVal N, ByVal w, ByVal ta)
Pi = Application.WorksheetFunction.Pi
mhu = 398600
vpp = (mhu / Math.Sqr(mhu * a * (1 - e ^ 2))) * (-Math.Sin(ta * Pi / 180))
fn1 = 2 * vpp
End Function
View 9 Replies
View Related
Jul 2, 2013
When I attempt to send a spreadsheet using a German version of Excel, the following formula does NOT work properly.
=ZELLE("adresse",C14)
The function gets translated into =CELL("adresse", C14), and what I need is, obviously, = CELL("address",C14). The argument does not get translated.
View 1 Replies
View Related
Dec 28, 2013
Can we use an array like {1;3;4;5} as Row or Column argument in INDEX function? Like shown below
=INDEX($A$1:$E$10,0,{1;3;2;4;5}) OR =INDEX($A$1:$E$5,{1;2;4;5;3},0)
View 9 Replies
View Related
May 29, 2007
In VBA, True takes the integer value of -1. However, in Excel, it is 1.
I am writing a custom function that does arithmetic on a value. However, due to above, if the value is True, my custom function produces a different result than if I wrote an Excel formula to do the same thing.
Is there some way to identify the data type of a value passed into a function? Currently my function looks like this:
' Return the valueToIncrement with its magnitude increased by PctToAdd
Public Function INCREMENTPCT(valueToIncrement As Variant, PctToAdd As Variant) As Variant
INCREMENTPCT = valueToIncrement * (1 + PctToAdd)
End Function
Ideally I would like to identify whether the type is Boolean and adjust the value so as to give the same result as an Excel formula would give.
View 8 Replies
View Related
Jan 8, 2013
I want my IF function to populate two cells with two values if argument for IF function is found TRUE. Is it possible?
IF(logical_test, [value_if_true], [value_if_false])
value_if_true = return multiple values in mutiple cells (for example put number 8 in cell A2 and number 10 in cell A3 if function is TRUE)
How would I do that? I tried putting IF(logical_test, (A2="8",A3="10"), [value_if_false]) but it is not possbile...
View 3 Replies
View Related
Sep 8, 2005
I am trying to create a function in VBA (possibly an add-in in the future) to
calculate Relative Standard Deviation (RSD). I would like to be able to use
an equation such as: =RSD(values), where the values are cell references (a
variable quantity) chosen by the user.
To do this I've copied scripts for "Mean" and "StdDev", then wrote a small
function for RSD that calls those two. When I try to implement RSD in the
worksheet (or even just Mean), the cell returns an error: #VALUE! I think
the problem has something to do with the Arr() variable used as the argument,
as I've tried some simpler functions with array arguments and can't get them
to work, but using standard non-array arguments works fine. I can write a
subroutine that calls the functions and displays the correct result, but I
would like to be able to use RSD as a typical function in my worksheet.
If I could get Mean to work properly, I should be able to apply that
knowledge to StdDev and RSD. The text for Mean is listed below. I've tried
quite a few modifications to try to make it work, so if someone could get it
to work and reply with the correct function text (or with another function
that performs similarly), I'd appreciate it. Thanks.
Function Mean(Arr() As Single)
Dim Sum As Single
Dim i As Integer
Sum = 0
For i = 1 To UBound(Arr)
Sum = Sum + Arr(i)
Next i
Mean = Sum / UBound(Arr)
End Function
View 14 Replies
View Related
May 14, 2013
Function Haversine has correct value in debugger but in cell it has the same value as Haversine2. Is this a known bug?
Public Function Haversine(lat1 As Double, long1 As Double, lat2 As Double, long2 As Double) As Double
Dim temp As Double
[Code]....
View 9 Replies
View Related
Dec 8, 2009
I am trying to return a TRUE or FALSE based on a date in a cell.
for example:
if cell A1 = 07/11/2009
I want A2 to show TRUE or FALSE if A1 is 14 days or more behind todays date.
I have tried stuff like:
=IF(A1=TODAY()-14,"True","False")
but it just always says false. EDIT: I have just noticed that if I change the date in A1 to exactly 14 days behind todays, it returns TRUE. So, it does work. Do I need to add a GREATER THAN in there?
View 6 Replies
View Related
Dec 29, 2006
I'm trying to get a "simple" function to return a number and not the #NAME?error!
I'm writing the following vba code. It's located in the sheet1 vba code area.
On the spreadsheet itself, on sheet1, column C, there is data from row 1 down to row 55. I have tried formatting the Column as General, text,etc.
Function Asset() As String
Asset = Range("C1").End(xlDown).Row
End Function
When I type into the spreadsheet =Asset() , I get the #NAME? instead of the number 55.
When I step through in debug mode, Asset shows Asset="55" , but my function doesn't return it!
View 9 Replies
View Related
Oct 21, 2012
I am trying to use a function to look at the value in one cell and return a value to the cell with the functional equation. I think I use the "IF" Function. But it is a little more complicated than I can do. In my sheet, there is a number in D3. I want to create an equation in D4 that evaluates the value in D3. If D3 is between 0 and 100, I want the equation in D4 to return the value 1; If D3 is greater than 100 but less than or equal to 200, I want D4 value to be 2; if D3 greater than 200 but less than or equal to 300, D4 return 4. I would like this to continue in increments of 100 until D4 equals 10.
View 1 Replies
View Related
Apr 8, 2009
Is it possible to add some code that will make the function return 0 if it would otherwise return #VALUE!.
Without getting to involved here is the main piece of code.
Public Function FixedCosts(RscNum As Integer, InstYear As Long, CalcYear As Long, MW As Double)
FixedCosts = numMonths * MW * Adjust * (CapCarryCostMonthly + OtherFixedMonthly + TransCap) / 1000
View 9 Replies
View Related
Feb 25, 2009
I am using an array formula like this in cells A2:H100 of a worksheet:
=INDEX('Source Data'!$A$2:$Q$5000,SMALL(IF(('Source Data'!$I$2:$I$5000>=$O$1)*('Source Data'!$I$2:$I$5000<=$P$1)*('Source Data'!$M$2:$M$5000>0),ROW('Source Data'!$A$2:$Q$5000)-ROW('Source Data'!$A$2)+1,ROW($Q$5000)+1),ROW()-1),1)
The function must be present in all 99 rows to accommodate potential data, but there is rarely enough data to populate the entire sheet, leaving #REF! errors in some cells. Putting aside that using this many array formulae is sloppy programming, how do I craft the function above to return no value if the function evaluates to an #REF! error?
View 4 Replies
View Related
Jun 5, 2009
I am trying to use the IF function to return a false value if the combined sum of a row is not the same as either of the 1st 2 cells. If that makes any sense!
This is the formula I would like to use. =IF(SUM(g3:g9)=g1 or g2 then y if true and x if false. I thought it would be easy but I can't figure out how to do it
View 2 Replies
View Related
Dec 26, 2012
I have following snippet of code. it is very simple.
Code:
Sub GetDatafromXmlToTemp()
Dim str As String
Sheets("sheet1").Select
desc = WorksheetFunction.Match("FAMILY_ID", Rows("1:1"), 0) ' gives column number for ex 4 for "D"
[Code] .....
I am getting error "Argument not optional" in line.
Code:
str = ColLetter
View 2 Replies
View Related
Jun 30, 2013
The function "VAL" will return the value of a numerical string as a double. Is it possible to get a similar function that will return the value as a long.
View 5 Replies
View Related
Jul 25, 2013
New to creating macro's but looking for a macro or a function to get the below results. The first 2 columns are givens and looking to return the 3rd column. Is there any code that can do this?
Hierarchy
Path
Expected results
000000010HIER_NODE
[Code]....
View 4 Replies
View Related
May 8, 2008
I have a cell with a text string >3, and would like it to return the number (not text) 3. I could use Right but since the number will not only be single digit I don't think this will work.
View 9 Replies
View Related
Jan 28, 2009
I've searched for an example of function that returns a variable, however, I'm unable to find one other than the one just has return variable on the end. I was wondering what I have wrong in the following code. This is placed in a module to make it available to all my worksheets.
Public Function findLR(Worksheet, Column) As Integer
LR = Worksheet.Cells(Rows.count, Column).End(xlUp).Row
return LR
End Function
View 9 Replies
View Related
Nov 22, 2007
I am looking for a formula that will yield the following: IFAH9>AI9 return the word Green, IFAH9=AI9 return the word Blue, IFAH9<AI9 return the word Yellow. If AI9 is blank stay blank.
View 3 Replies
View Related
Oct 18, 2013
The function Hlookup returns #N/A(?) if the value I'm looking for is not found. Is it possible to change this return-value. For exampel to #No or #No value ? I suppose I then need the code of this function? And I cannot get it?
View 1 Replies
View Related