Excel refrencing array with adress and indirect from another work sheet - arrays

As part of a formula in Excel I am trying to create a reference to an array which is located on Another work sheet. In order to do so I am trying to combine INDIRECT and ADDRESS in this way:
INDIRECT(ADDRESS(MATCH('current sheet'!E87;'sheet 2'!$C$2:$C$47;0);1;1;1;"sheet 2"))&":"&INDIRECT(ADDRESS(47;1;1;1;"sheet 2"))
I receive the correct addresses when I paste the address formulas on their own, but once i combine them with indirect and try to put them in the formula down below it doesn't work. Does anyone understand what the problem might be?
=INDEX(INDIRECT(ADDRESS(MATCH('current sheet'!E87;'sheet 2'!$C$2:$C$47;0);1;1;1;"sheet 2"))&":"&INDIRECT(ADDRESS(47;1;1;1;"sheet 2"));MATCH('current sheet'!E87;'sheet 2'!$C$2:$C$47;0))

I think you don't need to append "sheet 2" on the second part of your array.
Just try this.
Go to your main sheet pick an epty cell, enter = then click on to your other sheet and draw the array you want to index.
It will look something like this: ='sheet 2'!E4:F12
At the moment your formula makes a reference that looks like this: 'sheet 21!E4:'sheet 2'!F12.
You don't need the second 'sheet 2'! in the array.
Hope this helps.

Related

How can I auto fill a formula with dynamic value in array in the same cell?

so I have a formula inside an array that looks like this
={CRYPTOFINANCE("kraken:"&ARL8&"/USD", "price_history", "10d")}
I want to auto fill the array with the same function but with the 'ARL8' reference in an ascending order, just like auto filling cells, but keep it all in one cell it should look like this...
={CRYPTOFINANCE("kraken:"&ARL8&"/USD", "price_history", "10d") ; CRYPTOFINANCE("kraken:"&ARL9&"/USD", "price_history", "10d") ; CRYPTOFINANCE("kraken:"&ARL10&"/USD", "price_history", "10d")} ,SUBSTITUTE(TRANSPOSE(SPLIT(REPT(12,1050),2)),1,"MISTAKE")) etc.
the thing is that I have about 1000 values from ARL8 reference to ARL1008 reference so it will take really long for me to write it all manually, so is there a way I can keep the rest of the function but have the ARL cell reference dynamically written while being able to specify the length of the array?
It's something I am struggling for a while now and still couldn't find a way so I really appreciate if you could explain the solution as well, and if there is more info I can give let me know, and thanks.
I tried a few things but they gave me different errors I didn't know how to solve and others just didn't work, I will just put it in case it helps
=ARRAYFORMULA(CRYPTOFINANCE("kraken:"&ARL8:ARL1008&"/USD", "price_history", "10d"))
the error it gave me is - "error Attribute price_history isn't supported in batch formulas"
try:
=BYROW(ARL8:ARL20, LAMBDA(x, CRYPTOFINANCE("kraken:"&x&"/USD", "price_history", "10d"))
update
you can generate a formula with a formula like:
={""; INDEX("=ARRAYFORMULA({SPLIT(""Exchange,Base,Quote,Time,Open,High,Low,Close,Quote Volume,Base Volume"", "","")"&
QUERY(";QUERY(TO_TEXT(CRYPTOFINANCE(""kraken:""&"&C2&
SEQUENCE(C3, 1, C4)&"&""/USD"",""price_history"",""10d"")), ""offset 1"", )",,9^9)&"})")}
demo sheet

Printing array to variable cell range VBA

I have a variable array which I want to print into another workbook range. As I loop through separate arrays and secondary workbooks, the cell I want to print to will change.
Some sheets will need to array to be printed to A6:N, some will need the array printed to A300:N etc. I want to get to the bottom of the list of existing data and 'paste' the array below it.
Here is what I have so far:
bottomrow2 = Range("A9999").End(xlUp).Row
Set PasteCell = ClientBook.Sheets("PasteSheet").Range(Cells(bottomrow2 + 1,1),Cells(bottomrow2 + 1, 14))
Range(PasteCell & UBound(array)) = array
PasteCell is effectively trying to be my A1:N. It's worth noting that if I hard-code where to paste the array to, it works fine.
Range("A1:N" & UBound(array)) = array
'^This works fine.
Thanks for any help you can give.
You need to resize Paste Cell, so
Set PasteCell=PasteCell.Resize(ubound(array),14)
something like that. Or just use the anchor cell maybe, set paste cell to just be bottomrow2,1 ?

macro for automatic refresh function on array

I am creating a dynamic reporting tool that creates reports from data sourced from Wonderware. The data that is sourced is gathered from various pumps/flows/temps around site for operators/management to use. I want to create a dynamic sheet rather than use the wizards available because of limited IT experience of some of the operators.
I have managed to create the report but have one issue that i cannot resolve that would help the sheet become more user friendly.
I have some array formulas that link to cells that have dropdowns. (This is what helps make it user friendly). The drop down cells include, which server to look at, which tagname to look for, the start time, the duration and the number of cells in the array.
When changing the number of cells in the array cell dropdown the array doesnt change until you select a cell in within the array and then select the Refresh Function command. This then changes the array.
I want to write a macro that will select several cells on the sheet that have individual arrays and select Refresh Function command. I will then assign this to a shape that can quickly and easily be selected.
Can anyone help with this macro please?
You just need to add the reference to ActiveFactoryWorkbook in visual basic editor, and then something like this:
Range("B11").Activate
ActiveFactoryWorkbook.wwRefreshFunction
Be sure that in the cell B11 you will have a part of the array the query generates. As you have to refresh more than one array just copy the code again and change the cell reference.
Sub Workbook_RefreshAll()
ActiveWorkbook.RefreshAll
End Sub

VBA - Get data of array inside another array

I have created an array that contains another array into it, but now I am struggling to get the data from it. Please see the image attached.
Imagine I would like to access the string in channelsData(1)(1,1)(0,0) so the first red crossed string. How can I call it in an If condition condition for example?
Thanks in advance.
To get the data is as #Rory suggested. channelsData(1,1)(0,0)
To get the dimension of the array at channelsData(1,1)(i) is UBound(channelsData(i, 1), 2)

How to copy cell to array in Matlab

Alright let me explain detailed my question
this below image is displaying my matrix where i want to copy my data
Alright now what i want to do that is as you can see 1x4 cell
i want to copy it as an array to another variable such as
input_values=ones(1,4);%init
input_values=input_matrix_training(1);
So at the above i am trying to copy the elements in that cell array which is row 1 to the input_values array. But if i do as i above i am getting this instead of the values that array contains. ty
instead of above it should be like
The other values are a cell, and are thus best referenced with {} instead of (). Also, sometimes they need to be wrapped into [], depending on the format. Plus the fact that you don't need to initialize input_values, and what you should do becomes this:
input_values=[input_matrix_training{1}];
Or you can just use cell2mat
input_values=cell2mat(input_values(1));

Resources