Delete data validation error of dropdown in Google Sheets - google-sheets

I have a Google Sheets where I would like to have drop down menus in a column. When a choice is made in a drop down menu, I would like it to be no longer present in the others.
So I added a query function to subtract the values already selected. This works fine but I get an error message saying that the value is no longer present in the specific range. And this is quite normal as I am feeding the drop down menus with the data from the query function. And when I select a value in my dropdown, it disappears from the column where the query function is located.
So I would like to know if there is an alternative to not have the error message (either hide it or use another function).
Here is my sheet before filling in my drop-down menu :
And here it is after :
Here is my function:
=query(query({A2:A;C2:C}; "Select Col1, count(Col1) where Col1<>'' group by Col1"); "Select Col1 where Col2=1")
And here is the link to my Sheets if you want to check it out for yourself.
Thanks in advance for your help

Use a dedicated range for defining the available values per each drop-down separately. Insert columns to the right and use these formulas:
cell D2: =transpose(A2:A)
cell D3: =transpose( filter( A$2:A; isna(match(A$2:A; C$2:C2; 0)) ) )
Copy the formula in D3 down. Select cell C2, choose Data > Data validation and set the "List from a range" to =D2:N2. Save and reopen the dialog box to remove the dollar signs that appear by default.
Then copy cell C2 down.

Related

Google Sheets Query with Variables in the data section

I am trying to create a health related spreadsheet that has a lot of data - a lot of which isn't relevant to this question so I've simplified it. There is a column for each type of pain where you write on a scale of 0-10 how intense your pain was, and another column for any relevant notes. The data is broken up into named ranges to make it easier to display on different tabs (HeadData = Head Pain, ChestData = Chest Pain, etc. - 15 named ranges in total.)
One of the tabs I'm working on has a table where you are viewing only the specific named range, in this case HeadData.
=query({HeadData}, " Select * where Col1 is not null ",1)
This works perfectly, but I want to replace {HeadData} with a reference cell to a drop menu so you can select the specific pain area column you want to be displayed.
If I put the reference cell in G1 with a drop down list of the named ranges and select ChestData and try to do
=query({&G1&}, " Select * where Col1 is not null ",1)
It is only picking up G1 (ChestData) as a string and not the actual named range.
So my question is, is there a way to make a drop menu containing named ranges that turn into actual sets of data and not strings when placed in the data section of the query?
Here is my spreadsheet, any help is appreciated. Thanks!
https://docs.google.com/spreadsheets/d/1CcuSV2bbfxsUPPkmj-fru2yYYmmtpXk9LKEF85sxVUw/edit?usp=sharing
You can use INDIRECT for this.
INDIRECT
Returns a cell reference specified by a string.
Change your formula to
=query({INDIRECT(G1)}, " Select * where Col1 is not null ",1)
The INDIRECT function will convert the string in G1 to a cell reference and then the rest of your formula will query the relevant named range.

Display COLUMN number for TRUE in rank preference list in Google Sheets

I would like the option to toggle the display of compiled rank order responses in a grid between "response indicated" and "response indicated by rank number". I'm hoping for a formula solution rather than using Apps Script.
The included screenshot displays the current and desired outcome—with current as the example for "response indicated" (link to sheet below).
The grid pulls from responses on a separate sheet as shown in the included screenshot.
NOTE:
While the choice order on the input sheet is ordered 1-5, the display grid does not list the options in sort order.
There is a sort checkbox on map!C2 that informs whether the display grid uses the same order as input or sorts alphabetically.
The display grid uses separate formulas (B4 & C4—that do not reference one another) to populate.
The closest I've been able to generate is the first row toggling to the accurate ranking (using various combinations of QUERY, VLOOKUP, INDEX, MATCH, COLUMN)—but unable to generate an array output so that each row can create a specific response.
current C1 formula (uses named ranges):
=ArrayFormula(
IF(
REGEXMATCH(
IF(autoSort,
TRANSPOSE(QUERY(
TRANSPOSE(QUERY(
QUERY(inputTable,"where A is not null order by A",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)),,
COLUMNS(QUERY(
QUERY(inputTable,"where A is not null order by A",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)))),
TRANSPOSE(QUERY(
TRANSPOSE(QUERY(
QUERY(inputTable,"where A is not null",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)),,
COLUMNS(QUERY(
QUERY(inputTable,"where A is not null",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),))))),
autoOptions),
CHAR(10003),))
link to example sheet: https://docs.google.com/spreadsheets/d/1eRaRf-0n-VQ2zljqUpk38sMrFlCh19JAcv7IFMeFMw0/edit?usp=sharing
just a MattKing's mod with a checkmark switch:
=INDEX(IFNA(VLOOKUP(B4:B&C3:K3,
SPLIT(FLATTEN(input!A2:A&input!B2:F&"|"&COLUMN(input!B1:F1)-1&"|"&CHAR(10003)), "|"),
IF(C1=TRUE, 3, 2), )))
This should do it:
=ARRAYFORMULA(IFERROR(VLOOKUP(B4:B&C3:K3,SPLIT(FLATTEN(input!A2:A&input!B2:F&"|"&COLUMN(input!B1:F1)-1),"|",0,0),2,0)))

Data not moving with importrange

I have imported some data into columns A-D using QUERY and IMPORTRANGE which is sorted asc by column A (Last name). I then want to manually add data into columns E-P. However as the original sheet is updated with new users and those new people are added to my spreadsheet, my manual data stays where it is and then belongs to the wrong person.
So if someone is added with the last name that starts with A, all the names are shifted down a row, but all the data stays in the original row. So Mr. A was added to row 2 with Mr. B's data instead of a blank row.
Is there a way to tie the data together?
This is my current function:
=QUERY(ImportRange("Sheet ID","Sheet!A:F"),"Select Col1, Col2, Col6, Col5 Where Col1<>'' and Col6 contains 'Qualifiers' Order by Col1 asc")
I want columns E-P of the new names that are added by the importrange to be blank and all the data in columns E-P to be shifted down with every person.
this is standard behaviour of Google Sheets. to counter displacement of data across rows you are supposed to implement a simple ID system and use VLOOKUP to bring up the right data for the right rows.
where Tab A!A:B will be your QUERY and Tab B!B1:B will be your E-P data and ID is the link in between harnessed by VLOOKUP formula. also you will need to change 2 to {2,3,4,5,6,7,8,9,10,11,12} coz having 2 will return you only the first ("E") column

Google sheet query / filter with columns not Blank

I'am working on some document which get data from Non Google form, and the output is 36 column but there will be always filled up 8 max 9 columns with empty columns in between, with our Form we CANT change way how data are outputed. Empty column are here cuz Client fill up specific type of order so data are put in specific column.
i need query for pulling data from the main sheet and output just specific 5 specific column ( those will be always in same place ), and 2 columns that can be anywhere in between.
writing down every single column is not perfect as i need to pull data row by row not all at once ( i will be adding data in between final query output) and with that it would drasticly slow down file with few hundreds inputs added per week.
I didnt found working way to combine filter and query together to do this job ( removing empty columns [ <>'' and is not null].
Could someone help me with this ?
providing link for file : https://docs.google.com/spreadsheets/d/1SDR939yUSq9trLcxBid9AQeZUn-lNNiRr7O7pDiu888/edit?usp=sharing
In cell M1 of your sheet 'Desired output' try entering this little monster
=Arrayformula(query({'Raw data'!A:Z\
{"Configurable list"; 'Raw data'!D2:D&'Raw data'!F2:F&'Raw data'!H2:H&'Raw data'!J2:J&'Raw data'!L2:L&'Raw data'!P2:P&'Raw data'!R2:R&'Raw data'!T2:T&'Raw data'!V2:V}\
{"Date"; ('Raw data'!E2:E&'Raw data'!G2:G&'Raw data'!I2:I&'Raw data'!M2:M&'Raw data'!O2:O&'Raw data'!Q2:Q&'Raw data'!S2:S&'Raw data'!U2:U&'Raw data'!W2:W)+0}};
"Select Col1, Col2, Col3, Col26, Col28, Col24, Col27 Where Col1 is not null format (Col28) 'dd.mm.yyyy'"))
See if that works for you?
Your answer is really in the heading. You can use =filter([Range], [Range]<>"") for each row to get to this in the desired output. The filter function is perfect for this application.
UPDATE:
Looked at your sheet to get a better view of the problem. You'll need some wildcard workaround as shown here as a second criteria to identify the Date & Configurable cells: =filter([Range], [Range]<>"", search("Date", [Top row]))

Index row formula error on Google spreadsheet

I have a formula in Google spreadsheet from cell B2 all teh way to B100 which is
B2=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(1:1)),0), "")
B3=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(2:2)),0), "")
B4=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(3:3)),0), "")
B5=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(4:4)),0), "")
..
...
......
So it is pulling up values from a second tab which is named as "DB".
The Index row formula looks for the status "Completed" ( which is on cell A1) and return the details for all completed from the DB.
Google spreadsheet
main spreadsheet
Database in tab 2 (DB)
DB
The formula works fine , however i am getting duplicates of every cell which got the status "Completed "
Attached links to the screen shots for your reference.
Don't know what i am missing. 0_o
Thanks
I think you can use QUERY() for what you try to achieve.
Have a look at this example sheet and check sheet 2 where this formula is used to filter the data from sheet 1:
=query(Sheet1!A:H, "select * where B = '"&A1&"' ")
(where A1 is a drop down list with the values 'COMPLETED', 'in progress', 'resolving').
See if that helps ?
there is no need for formula here.
This is simply done by filtering:
Supposing you have a DB sheet like this
In your main sheet, put DB!A1 in cell A1, and drag and fill horizontally and vertically, to copy exactly your DB sheet into main sheet (you can do this selectively as well, there is no need to copy every column, just cpy those you want). Then click on FILTER, you can find it in SORT AND FILTER, then you will see a dropdown menu on all of the column headers. Simply by clicking on your status header, you can selected completed and press OK, it will ONLY show rows with completed on their status column.
And here is the link to download this example sheet
your links don't work for me.
You should use the FILTER() function, that is designed exactly for this purpose:
in cell A2 on your second sheet use: =filter('DB'!B:AC,'DB'!B:B=$A$1)
As suggested I would use Data validation with dropdown list, so that only valid statuses may be chosen.

Resources