Google Sheets Function replication - arrays

Is it possible to have a function that contains two ranges and you want to drag that formula across multiple cells but only have one of the ranges auto-advance while keeping the other function the original without advancing?
Here is the function
=IFNA(JOIN(", ", FILTER(Input!A5:A31, Input!JZ5:JZ="V")))
I want to drag this across multiple cells in a row, however, I only want the Input!JZ5:JZ="V" portion to advance to Input!KA5:KA="V" and leave the Input!A5:A31 the same due to that's the location of the information I am looking for and doesn't change.
Currently, both will advance to the next cell and so I am having to go back and fix each one and I have about 300 of these I need to do.
Any suggestions, please?

sure, lock it down with $ symbols. try:
=IFNA(JOIN(", ", FILTER(Input!$A$5:$A$31, Input!JZ5:JZ="V")))

Related

Is there a way to duplicate every value in an excel array?

I am trying to duplicate all values in an array in my sheet. I have {1,6,14,15} and I want to output {1,1,6,6,14,14,15,15}. I would like to do this exclusively with functions. I have seen the VSTACK function, which seems very useful, however joining the insider thing seems like a hassle and would not allow this spreadsheet to be usable across other devices easily.
I have tried the CONCAT function, however this simply returns 161415161415 which is not helpful to me. The various alternatives to VSTACK all remove duplicates, which is exactly not what I am looking for. Besides all of those alternatives are lengthy and hard for me to wrap my head around.
You could use EXPAND() here:
=LET(arr,{1,6,14,15},TOROW(IFERROR(EXPAND(arr,2),arr),,1))
Note that 2 will define how often you want to duplicate the input.
If you have LET and SEQUENCE:
=LET(ζ,{1,6,14,15},INDEX(ζ,SEQUENCE(,2*COUNTA(ζ),,0.5)))

Get value of same cell from multiple sheets

I'd like to get the value of cell A1 from multiple tabs in my sheet. I attempted to use INDIRECT, only to be reminded that it wouldn't work in an ARRAYFORMULA. Is there some sort of "makeshifty" formula that would do the same thing?
This is what I originally attempted:
=ArrayFormula(IF(LEN(A2:A),INDIRECT(A2:A&"!A1"),))
Column A is a select list of the tab names in my sheet. So the first instance works, but of course, it doesn't populate down the column as I had hoped. I realize I can just copy the formula down the column, but some type of an ARRAYFORMULA would be ideal as I add rows to the list.
I found this answer, but don't see how I could apply it to my situation.
I also found this answer, but thought since it's 2.5 years old, maybe someone has discovered a clever way to avoid the drag of copying.
Answer:
You need to do this with a script or by using the drag method - INDIRECT uses a string reference and so can't be used with an array.
More Information:
Unfortunately for the user of INDIRECT with ARRAYFORMULA, a discovery of a clever method isn't the issue - the limitation of what can be done with only formulae that is the root of this problem.
Setting up a custom function:
From the Tools > Script editor menu item, you can create scripts. An example custom formula that you could use would be as follows:
function ARRAYINDIRECT(input) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
return input.reduce(function(array, el) {
if (el[0]) array.push(el[0])
return array;
}, []).map(x => ss.getSheetByName(x).getRange("A1").getValue());
}
Make sure to then save the script with the save icon.
In your Sheet you can then call this custom formula as so:
=ARRAYINDIRECT(A2:A)
Rundown of the function:
Takes the input range from where the formula is called - in this case A2:A
Reduces the input to remove all cells that are empty
Maps the name of the sheet which is stored in the cell to the value in A1 of the sheet it references
Returns an array to output
References:
JavaScript Array reduce() Method
INDIRECT - Docs Editors Help
ARRAYFORMULA - Docs Editors Help

Using CONCATENATE in a MATCH Function

So I'm creating a Hyperlink that will go to a specific Tab. There are multiple tabs.
=HYPERLINK(CONCATENATE("#","'",G3,"'","!E")&MATCH(E3,CONCATENATE("'",G3,"'","!E:E"), FALSE),"GO")
The first CONCATENATE works, but the 2nd one in the MATCH function returns "'G3'!E:E" and results in a #VALUE! error.
The reason I need it to go to G3 is that's the Tab Name I want it to go to. Different lines will go to different tabs and I'm trying to make it automatically populate with the Tab Name.
Help! And Thanks in Advance!
~Michelle
Though HyperLink accepts a string, MATCH does not. So you need to use INDIRECT in the MATCH to turn the string into a viable range reference:
=HYPERLINK(CONCATENATE("#","'",G3,"'","!E")&MATCH(E3,INDIRECT(CONCATENATE("'",G3,"'","!E:E")), 0),"GO")

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

Issue reading .txt file in Matlab. I want to get an array from this file without the unnecessary info it contains

I'm having trouble reading a .txt file to get some data. I want to be able to change some of the values this data contains.
At first, I used this:
A=importdata('myfile.txt');
And got this cell array:
Now what I want is this:
1) Get rid of the headers (the information from cell 1 to 22). That could be easily done by simple indexing (creating a sub-array using just the info from cell 23 to the end of the file).
2) I want to separate the information into different cells, using these identifiers. But I don't know how to separate them into different cells of the array.
'# item bepoch ecode label onset diff dura b_flags a_flags enable bin'
3) Do the same in step 2 to fill those columns with the data in the rest of the cells.
I'm trying to use this approach, but I'm not getting the expected results.
If someone can help me, I'd be glad.
Have you tried dragging the file into the variable workspace window and using the data import wizard? It has some nice features that normally take care of what you are trying to do automatically. Unfortunately, it seems that your text file may have unconventional spacing, but Matlab may be able to handle it if you set the delimeter to ' ' or suchlike.

Resources