In an Excel file I saw lookups on several cells that look like this:
#SomeString
#AnotherString
Both return some values. I didn't know or use # command before but now learn that it's a kind of lookup. Now if I find SomeString by looking in the value across the whole workbook, I can locate the lookup. However I can't find AnotherString that way.
Is there any way I can find the lookup location? Additionally, is it possible that if the lookup is in fact deleted from the workbook, the value returned from a previous reference is still valid, as it may be the case here?
UPDATE: It turns out they refer to several defined names.
I am currently trying to optimize a VBA code with extreme execution time (56 hours and more on high end PC). The main problem is nested loops (up to 8) due to complicated iterative calculations and referencing ranges in formulas.
I have two questions:
1)
What loops are most preferred in VBA (based on their hardware strain for lack of better word)
2)
Is there a way to reference variable range of cells in a formula? For example in formula:
=AGGREGATE(15,6,SQRT((R2C10:R500000C10-RC[10])^2+(R2C11:R500000C11-RC[11])^2+(R2C12:R500000C12-RC[12])^2),1)
I am referencing relative cell: "R500000C10". There are two main issues: For one, the half milion cells might not capture all data - though in most cases there is less active cells than that, in same cases that might be an issue. Second, it takes forever to scan through so many cells (same reference is used in multiple of VLOOKUPs).
The first issue could be solved by referencing the whole column, but that makes the second problem worst.
I would like to reference it in a similar way that xlDown works:
Range().End(xlDown).Select
The problem there is I would need to reference it within the Active.Cell.FormulaR1C1. Is there a way to do that?
Thanks!
Well you wrote that you have a code with 8 loops and try to optimize it maybe you can edit and put part of that code, because your description is very general, however, with information that you put i speculate that about your point
1)it depend what do you want to do? because each "loop" have their own use for specifyc scenaries
2)there are tricks to do that but all depend what are you trying to do and why you want to use .formulaR1C1
again im speculating but you can try tu separate your loops in indenpendent function, and maybe you are putting a formula inside cells, and question is why? you can create functoins and Sub in your VBA code and do your "extrem execution" without use xtra "resours"
I would like to use SUMXMY2() by only using named ranges, but have been running into problems.
Basically I am trying to sum the square of the differences of each value of a subset from a single value
I first started with basic data to understand the formula and make sure it was doing what I wanted, that went fine. I then moved to try to include only named ranges. The first challenge was to create an array out of a single value which was done by using the INDEX() technique: INDEX((5*ROW(1:8))/ROW(1:8),) but that already breaks down when used with named ranges.
Here is the mess:
SUMXMY2(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)),
index((AVERAGE(INDEX(NamedRange,
MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)))*
row(1:count(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)))))/
row(1:count(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)))),))
As said earlier, I am trying to sum the square of the differences of each value of a subset from a single value. This just gives me NA. I'm trying to figure out a way to do this without out the formula, but am completely stuck
The solution for those interested
=SUMXMY2(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)),INDEX((AVERAGE(INDEX(NamedRange,MATCH($C$6,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)))*ROW($A$1:INDEX($A:$A,COUNT(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0))))))/ROW($A$1:INDEX($A:$A,COUNT(INDEX(NamedRange,MATCH($C$4,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0))))),))+
SUMXMY2(INDEX(NamedRange,MATCH($C$6,COB_Date,0)):INDEX(NamedRange,MATCH($C$4,COB_Date,0)),INDEX((AVERAGE(INDEX(NamedRange,MATCH($C$6,COB_Date,0)):INDEX(NamedRange,MATCH($C$5,COB_Date,0)))*ROW($A$1:INDEX($A:$A,COUNT(INDEX(NamedRange,MATCH($C$6,COB_Date,0)):INDEX(NamedRange,MATCH($C$4,COB_Date,0))))))/ROW($A$1:INDEX($A:$A,COUNT(INDEX(NamedRange,MATCH($C$6,COB_Date,0)):INDEX(NamedRange,MATCH($C$4,COB_Date,0))))),))
I've been using a rather long embedded CUBEVALUE() function, which is a pain to work with. It looks something like:
=IFERROR(VALUE(CUBEVALUE(arg1;arg2;arg3));CUBEVALUE(arg1;arg2;arg3))
Due to the CUBEVALUE function and its arguments, it's becoming a REALLY long function and thus not easy to work with. Since there are only 3 arguments, which are written in different cells, I'd like to create something like
=MyFunction(A1,A2,A3)
and use A1, A2 and A3 as "arg1, arg2, arg3" in the function mentioned first. This way its possible to "pull" the function so it would calculate using the input in B1:B3 and C1:C3 etc. as well.
The function works fine and can be pulled through and such, but my question is how to rename this loooong function into something more user-friendly, as it requires only 3 cells as an input and the rest of the text in the function just makes it hard to use for end-users.
Using UDF is not an option because CUBEVALUE can't be called through VBA... and any attempt to stich strings together and using the final result with INDIRECT also seems to fail..
In a similar question on this site, someone refers to using "asynchronous UDF's", but no further information was given (and what I could find seemed irrelevant).
You shouldn't really have several long cube functions. Allocate some space in hidden rows/columns or in header rows/columns to add your cubemember functions. Then throughout most of your report, you should just have cubevalue functions that reference other cells with error handling around them. Proper use of absolute and relative references are your friend.
Peter Meyers has some great tips for this here, slides 20 - 24. I have an example Excel file with cube functions on my blog here.
I've spent several hours trying to come up with a clean solution to this, and I just don't seem to be able to.
Basically, I have several dynamic ranges that I have defined, and I want to select one based upon a condition. It seems so straightforward! The reason that I want to select this dynamic range is so that I can graph the range.
Indirect does not work.
DIndirect (A common VBA algorithm) does not work.
(Or I can't get them to)
Choose works! However, the maximum length of a dynamic range is very quickly reached, which means I'm forced into inane solutions like the following.
I define dynamic_dynamic
=IF(A1<3,CHOOSE(A1,'WorksheetName'!dynamic_range_1, 'WorksheetName'!dynamic_range_2),'WorksheetName'!dynamic_dynamic_2)
Then I define dynamic_dynamic_2
=IF(A1<5,CHOOSE(A1-2,'WorksheetName'!dynamic_range_3, 'WorksheetName'!dynamic_range_4),'WorksheetName'!dynamic_dynamic_3)
Then I define dynamic_dynamic_3
=IF(A1<7,CHOOSE(A1-4,'WorksheetName'!dynamic_range_5, 'WorksheetName'!dynamic_range_6),'WorksheetName'!dynamic_dynamic_4)
.... And so on.
Really? I'm sure I'm being an idiot, but nothing else seems to work!