Index formula with dynamic array reference - arrays

I have a table that is referencing a pivot table on the same sheet. I added a form control scroll bar to be able to flip through the data without changing the view.
The headers of that table are linked to the headers of the pivot table. I am trying to write the =INDEX(L3:L$17,$D$6) formula so that the column info is adjusted automatically.
I managed to use the columnletter to convert the match of the header to the correct letter but don't know how to adjust the Index formula to use that info.
The goal is to change the index column array reference whenever I change the header dependency to another column.
change to Header from City to Street, should change the Index formula to use column M instead of L

The Match function will search the header word in the pivot table.
So you can change the words in the header and get the results for it without changing the formula.
Option 1 E8= =INDEX($L$3:$N$26;$F$3+ROWS($E$8:E8)-1;MATCH(Q$6;$L$2:$N$2;0))
Option 2 Q7=INDEX($L3:$N$26;$F$3;MATCH(Q$6;$L$2:$N$2;0))

Related

I want to add a column of identical text values to the output of the FILTER function

I'm using VSTACK to combine the output of different filters (same structure, but from different worksheets). However, I want to be able to identify from which sheet each row has been filtered, so I was wondering if it is possible to add a column to each array to contain a certain identifier. Essentially this would be the same as using HSTACK for the filter output and a custom array with 1 column that has all the same values. Any ideas?

IFERROR MATCH formula not searching whole sheet

We use a sheet to look up information. There are 936 rows and will get more as time goes on, however the query returns a blank result (as it should) after row 600, how do i change what the search/lookup area so it will search the whole table on a separate sheet and return the results?
=IFERROR(IF($D$5=""," ",INDEX(allvehicles2,(MATCH($D$5,indexes2,0)),7))," ")
Tried to alter the selection and even moving to another sheet but would not return the results.
If you are able to, try using Tables with the XLOOKUP function.
It simplifies the formula and the table will automatically grow as data is added to it.
This ensures that the formula will use all the data.
Make sure that the data you are using to lookup against is continuous.
That is no empty rows or columns.
Ensure that it has headings.
Turn it into a table by selecting it and pressing Ctrl + T.
You can change the name of your table by selecting the data and not the headers.
Then use the Name box to change the name.
Then use the XLOOKUP function, with the lookup_array and return_array values each being a column in the table. If the value is not found, an empty string will be returned.
Formula structure
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])
Example formula based on the screenshot
=XLOOKUP(A2,MyTableName[Key],MyTableName[Value 6],"")

Find and repeat a cell value if values match

My spreadsheet is collecting data from a form
On another tab I'm showing the responses that match "Lesson day" with "Today's date" (in the example, all the lessons are showed).
As you can see, the "e-mail" field is filled out only once.
Is there a way to automatically fill the "e-mail" field in the second tab? Maybe matching the "Student Code" with the "e-mail" fields in the first tab?
I've tried the MATCH() function but it returns only the position. I feel like I need to combine MATCH() with other functions but I have no idea about where to start
EDIT: Having the email adresses on another column would work too.
SOmething like: if the "Student Code" in the 2 tabs matches, show the email adress for that "Student code"
try:
=ARRAYFORMULA(IFNA(VLOOKUP(D4:D, FILTER({form!E2:E, form!G2:G}, form!G2:G<>""), 2, 0)))
change form to match the sheet name of your form sheet
As suggested, I created an auxiliary table (just called Sheet7) and getting closer to the desired result
In A column I used
=UNIQUE(Lessons!E:E)
In column B I used
=INDEX(Lessons!A:M, MATCH(A2,Lessons!E:E,0),7)
Then, on my second spreadsheet, I could get all the e-mail adress using the following formula
=INDEX(Sheet7!A:B, MATCH(D4,Sheet7!A:A,0),2)
I've tried to use ArrayFormula on the auxiliary table
ARRAYFORMULA(if(A2:A="",,INDEX(Lessons!A:M, MATCH(A2:A,Lessons!E:E,0),7)))
But it doesn't work. It shows only the email adress matched from the cell A2, ignoring A3, A4,...
A different approach:
Make an extra column in your form responses sheet called "Student E-mail".(In this example it is column "I")
In row 2 of that column, write the following formula:
=ARRAYFORMULA(IF(ISBLANK(G2:G),VLOOKUP(F2:F,INDIRECT("F$2:G"&ROW(I2:I),TRUE),2),G2:G))
Use that column for the emails in your other tab (hide the original email column)
Update:
Using array formula, you don't have to manually drag & drop. And it keeps going as new rows are added.
Usually MATCH is combined with INDEX
You should build an auxiliary table with one column for names and another for ee-mails.
To build the auxiliary table from the collected data you could use something like this
=UNIQUE(FILTER({Lessons!E:E,Lessons!G:G},LEN(Lessons!G:G)))
The above is better than using a formula for each column as this prevent having mismatching data.
INDEX / MATCH usually doesn't return the "expected" results in an ARRAYFORMULA. Instead use VLOOKUP.
NOTES:
Please bear in mind that every time that you edit a value the formula will be recalculated. If you have a lot of formulas (like when doing a fill down to copy a formula to all the cells in a column) or having an ARRAYFORMULA with open ended references i.e. G2:G this could affect your spreadsheet performance.
If you go for using an ARRAYFORMULA, use ARRAY_CONSTRAIN to limit the number of rows returned by your formula.
Related
How to map values between columns in worksheets

Excel Array formula IF with multiple criterias

In my spreadsheet using array formula I am creating a unique list of values based on multiple conditions. Formula is below:
{=INDEX(INDIRECT($O$3&"!$L$2:$L$"&$O$16),SMALL(IF((INDIRECT($I$3,FALSE)=$O$7)*(INDIRECT($K$3,FALSE)=$O$9)*(INDIRECT($M$3,FALSE)=$O$11)*(INDIRECT($X$17,FALSE)=$O$15)*(INDIRECT($AF$17,FALSE)>$O$15),ROW(INDIRECT($O$3&"!$L$2:$L$"&$O$16))-2,""),ROW()-20))}
Question belongs to this part if IF function:
(INDIRECT($K$3,FALSE)=$O$9)
Cell $O$9 contains drop down which includes one of cell content variables as well as <>, <>*, <> * Text*,""
When I use direct text match: specific column contains list of fruits and "apple" is one of the values, once $O$9 contains word "apple" formula works and I get a unique list. Should $O$9 contain any of above mentioned combinations (<>, <>*, <> * Text*,"") it gives me an error.
Question: How to change "=$O$9" so that it will be able to use following content of the $O$9 equals to <>, <>*, <> * Text*,"", etc.
Note: I cannot adjust drop down in cell $O$9 but can modify array formula only.
Thanks in advance!
Well this is by no means a complete answer but just to show my thinking:-
Suppose you have two column ranges which I have called AA and BB and you want to implement some of your tests based on $O$9. It would look something like this:-
=SUM((BB=1)*IF($O$9="<>",AA<>"",IF($O$9="<>*",AA="",IF(ISNUMBER(FIND("*",$O$9)),ISERROR(FIND(MID($O$9,4,LEN($O$9)-1),AA)),$O$9=AA))))
So what I am saying is that your (INDIRECT($K$3,FALSE)=$O$9) would have to become something like the contents of the brackets following SUM above.

Create array with vlookup

I want to conditionally grab lines from a database-style spreadsheet in Google Spreadsheets (a list with a name, location, description, price) after checking the value with a vlookup - I've used this a while ago and expected it to CONTINUE an array across for the other columns next to the one 'looked up', but it seems my memory fails me here and it just retrieves the 'searched out' value.
=vlookup("Yes",'All 2014-15'!A2:G,2)
This formula basically finds the first value of the desired rows and should create a 'Selected items from 2014-15' list, but I can't work out how to expand it to produce a list of all the rows I want. Is there a simple way to retrieve this, I've tried playing with arrayformula but no success.
I can change the index simply to get the other values across, but if this could be filled out through an array too that would be preferable...?
Can you try this...
=FILTER('All 2014-15'!A2:G,'All 2014-15'!A2:A="Yes")
Edit:
As suggested by Immx, added apostrophes to sheet name and the second range changed to A2:G to A2:A assuming the yes/no data is in A column.

Resources