Excel - dynamic data validation lists for multiple rows - arrays

Excel 16.x for Mac
I have a situation where we have a tabular spreadsheet template for requisitions. The spreadsheet is copied for each project and filled out. Each spreadsheet will have multiple rows - from 1-400. Each row has columns with data validation rules.
The issue is that I cannot figure out how to enter a formula that generates a different list for each row the data validation formula entry.
eg:
Each row will have a "Facility Code" and a "Building Code". The "Building Code" list is generated by what is in the "Facility Code" cell. The problem is that the data validation rule wants a range of cells, not a formula that generates an array. With sometimes 400 rows, I would need to create 400 different lookups based on the R(n):Facility_Code entry.
Dynamic List for Facility Code (in Template!P4):
=UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]<>""),""))
Dynamic List for Building Code:
=UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]='Template'!P4),""))
The P4 is the issue here as it will change by the row.
The Data List validation points to a range of cells.
The current behavior is on R1, it works fine. On R2, no matter what is entered into "P5", it generates the data based on P4 (as it should as that is what is in the formula).
Is there any way to have the Data Validation formula be dynamic based on the R(n)? The intent is to have the Data Validation range be a dynamic formula replacing P4 with tableName[facilityCode]

...Ignore my previous answer.
Putting a FILTER isn't going to work inside a DV with a dynamic reference for some reason.
You'll need a hidden sheet, and in that sheet each row on the input sheet will have a corresponding row of options. They key is to use =TRANSPOSE() around the FILTER() to make the results in rows not columns (so they don't cause #SPILL! errors.
Once you have that setup, just point the DV to the sheet with a spill reference (with a # behind it): example in Sheet BUILD_CODE_OPTIONS!A4:
=TRANSPOSE(UNIQUE(FILTER(NFS_Facilities[Facility Code],(NFS_Facilities[Facility Code]='Template'!P4),"")))
then in the DV for the Building Code field on row 4:
BUILD_CODE_OPTIONS!A4#
You'll need a sheet for every column you want a dynamic drop down in.
... now just waiting for MS to fix the bug preventing the FILTER in the DV ...

Related

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],"")

Google Sheets: Sum, Query, other Formulas Treating Values (Formatted as NUMBERS) as Zeroes in Formulas - Unclear why

I have 15 Google Workbooks that import into 1 Workbook tab through an Importrange + Query combo function. The data is then queried and transformed across several other tabs, but the problem definitely begins on this tab.
Although I've manually forced a format change to "Number" in each workbook source AND in Columns CO:CQ (where the problematic data lands), all functions see the data as zero or null. Here is what happens when I set a random cell (CW33) equal to a cell in one of the trouble columns (CO33)
However, when I wrap the cell in an =sum(), the workbook returns "0":
I have no idea how to force the workbook to see the values in these rows as numbers without creating an entirely new column - does anyone have any ideas on how to fix it while preserving the column structure?
Thanks!
try:
=SUM(CO33*1)
for multiple cells it would be:
=ARRAYFORMULA(SUM(CO33:CO34*1))
or:
=SUMPRODUCT(CO33:CO34)
AFAIK, in Sheets, a Number formatted cell displays contents right-aligned and Plain-Text are left-aligned. The highlighted cell looks like a text cell.
Try changing the format of cell or column manually to 'Number' from the 'Format' tab.

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

Default cell value on insert row from Forms

I'm trying to create a live quiz with results from a Google form. It inserts rows into my custom sheet, but one of the values which is a sum() of specific cells is ignored on insertion, is there a way to set the default value of a specific cell when a new row is inserted to the specific sum formula I require?
I have seen various examples but all are more complex than I need an I am unable to unpick them.
Is it also possible to specify a checkbox in a cell as well?
try:
={"TOTAL"; ARRAYFORMULA(IF(A9:A="",,MMULT(FILTER(D9:CE,
MOD(COLUMN(D9:CE)-1, 2)=0)*1, ROW(INDIRECT("A1:A"&COLUMNS(D:CE)/2))^0)))}
spreadsheet demo

Using Excel Functions to Get Data into a Single Cell

I'm working with the Bloomberg Add-in on Excel to gather some data. The problem I'm having is to get all the data into a single cell. For instance, I want to get the daily change % for the past 5 fives for IBM. The formula I am using is:
=BDH("IBM US Equity","CHG_PCT_1D","11/9/2012","","Array","TRUE")
I made this using the Formula Builder, so I'm not sure why this isn't working. It returns error message: "#N/A Invalid Parameter: Invalid Override Field ID Specified"
If I exclude the whole array part, then it returns the data I want but in 1827 or so different cells. Any way I can get all of these in one cell?
Thanks
Use the working method that fills cells A1 through A1827.Then in cell B1 enter:
=TEXTJOIN("",TRUE,A1:A1827)
This cell will contain all the data you require.

Resources