I have the following code
=IFERROR(IF(INDEX('Combined Page'!I:I,(MATCH('Load & Unload (7)'!A272,'Combined Page'!A:A,0)))>=35,"Completed","Available"),"")
Instead of having A272 I wanting to use A then row()
How would I write this?
Thanks
As suggested
=MATCH(INDIRECT("'Load & Unload (7)'!A"&ROW()),'Combined Page'!A:A,0)
Works. Thanks
Related
I'm working with data from Bloomberg. My code is :
Sub Code_Fin()
Sheets("SPX").Cells(2, 3).Formula = "=BDS(""SPX Index"", ""INDX_MEMBERS"",
""END_DATE_OVERRIDE=20210810"",""cols=1;rows=1000"")"
End Sub
Do you know please, how replace the ""END_DATE_OVERRIDE=20210810"" by something like ""END_DATE_OVERRIDE=today()"" ? I would like to change the date automatically.
Thank you !
I'm having trouble calling the textbox on the form inside a module. Every time I run it, it throws a Compile Error: Method or data not found. This is my code:
Sub formInitialize()
ThisWorkbook.txtDate.Value = ""
End Sub
Thank you for your great help!
Thank you for your time. I have already figured out my problem.
I should not be using the ThisWorkbook, I should be calling the formName. The code is as follows:
Sub formInitialize()
formName.txtDate.Value = ""
End Sub
Thank's again!
I want to but an OR in this IF statement. For example IF cell="2" OR IF cell="4" OR IF cell="hello".
Can you help me? In the current code i have only an IF cell="2".
Cell.FormulaR1C1 = "=IF(left(RC[2],1)=""2"",""delete"",""1"")"
Try this (untested but hopefully will work):
Cell.FormulaR1C1 = "=IF(OR(left(RC[2],1)=""2"",left(RC[2],1)=""4"",left(RC[2],1)=""hello""),""delete"",""1"")"
Here is the formula in question.
.Range("F5").Formula = "=SUMPRODUCT(--(I23:I29>='Raw Data'!K2),--(I23:I29<='Raw Data'!K3))"
This works fine, but what I want is instead of I23:I29, I want it so that when I did a "lastrow" formula in excel VBA, it will replace the I29, with the I and whatever the response in the last row actually is.
I figured that to make this happen I'd have to break the parentheses, but I wasn't sure if it was the correct thing to do.
What I thought I'd have to do is this:
.Range("F5").Formula = "=SUMPRODUCT(--(I23:I" & lastrow">='Raw Data'!K2),--(I23:I" & lastrow"<='Raw Data'!K3))"
But it doesn't look right. And Excel is giving me a redline for it as well, so I know I'm not doing it correctly. Can someone help me figure out this little nightmare?
Close - watch out, and make sure the & are between every part of the string build:
.Range("F5").Formula = "=SUMPRODUCT(--(I23:I" & lastrow & ">='Raw Data'!K2),--(I23:I" & lastrow & "<='Raw Data'!K3))"
In excel if I have the following
=match("abc",A:A,0)
if it errors then it throws some thing like
#value
so i tide this up by saying
=iserror((match("abc",A:A,0),"Not found",match("abc",A:A,0) )
but this seems messy code.. running the same formula twice, can this be formated better to give the same result?
Cheers
Which version of Excel are you using? In Excel 2007 or later versions you can use IFERROR function to avoid repetition
=IFERROR(MATCH("abc",A:A,0),"Not found")
or in earlier versions you could employ COUNTIF
=IF(COUNTIF(A:A,"abc"),MATCH("abc",A:A,0),"Not found")
I'm not aware of a built-in way to do this, but you could write your own VBA function:
Function GracefulError(varValue As Variant, strMessage As String) As Variant
If IsError(varValue) Then
GracefulError = strMessage
Else
GracefulError = varValue
End If
End Function
Usage:
=GracefulError(match("abc",A:A,0), "Not found")