How to create a custom formula using data validation that can sort columns using column numbers in Google Sheets? - sorting

I hope someone can help with a problem I’m facing. I’m pretty new to Data Validation using Custom Formulas so I’d appreciate your guidance. I hope I have explained the situation clearly. Thanks.
I want to use data validation in cell B1 (Portfolio Tab) which creates a drop down list of the number of columns (1 to 44). I want to use the list as a way to sort a table (Column Headers - C3:AT4).
https://docs.google.com/spreadsheets/d/1qunKbFGNzzGU9lNCPFow8igkR_gaPudmanTK-WM43mA/edit#gid=58173089
By selecting 1 from the drop down list I want my table to be sorted in Descending order by Portfolio%. Then if I want to sort by Name in Descending order I want to select 3 from the drop down list. Finally once I’m done sorting I want to revert back/reset to my original view. I want to do this without changing anything in columns A and B. Please assist. Thank You.
Issue with using asc
Issue with using asc (blank formula)
Query and hyperlink
Query and hyperlink

solution 1:
forget dropdown and use filter view inmerge row 3 & 4
delete row 1 & 4
select your range C2:AT
and creatte filter view
now you can sort one, multiple or all columns like:
solution 2:
create a duplicate of your sheet:
delete your range C3:AT
use this in C3:
=QUERY({Portfolio!C3:AT}, "order by Col"&B1&" desc", 2)
solution 3:
use sorting script... https://stackoverflow.com/questions/tagged/google-apps-script+sorting

Related

Additional row with empty header in matrix in power bi

The problem is probably trivial but unfortunately I can't figure it out. Here are two basics tables:
I tried to create the matrix based on the selected ID (from the Table2) with values from Table1. I created a measure "% Margin" (margin divided by revenue) and tried to add this to the matrix with ID from Table2. Every time besides ID from Table2 I got one additional row with empty ID. Anyone has an idea how to get rid it off? The rest of the matrix is correct.
Instead of using a separate static table, simply add a new column to you table and use that to filter your data for the report.
Here's how this would look like:

Google Sheets - QUERY order by dependent drop down

I am trying to setup a QUERY with dynamic ordering. I've tried to link the ORDER BY function to the output of the dropdown menu but that doesnt seem to work. I have recreated the problem with a simple example: https://docs.google.com/spreadsheets/d/1m3Lhm5lp2DW7XF8hRbDAiOAAsOyCXrie-Nc-0bWG6hA/edit?usp=sharing
I've created a table (3x4) with three variable and would like to dynamically sort the table by each variable through QUERY both ascending and descending.
Would also be interested to learn if it's possible to dynamically setup the direction (ACS or DESC).
Any suggestions would be much appreciated.
Kind regards,
Webko
try:
=QUERY({A2:C6}, "order by Col"&MATCH(F1, A2:C2, 0)&" "&G1)
where G1 dropdown is asc,desc

Insert a new Google Sheets row into Alphabetically Sorted spreadsheet

I am working with two spreadsheets; the first spreadsheet takes a name and then automatically adds it to the next spreadsheet which is sorted alphabetically by name. The problem is, I need a new row to be created, otherwise the data from the row above it gets added along with the name. Here is the query I am using: '=query(Referrals!A2:O, "select * where C is not null order by D")'. I don't think this can be done with a query, so I have been exploring Google App Scripts. I am not sure how to insert into the pre-sorted list, though. Any help is greatly appreciated!
Have you tried offsetting the header so you can run it for the range of the sheet?
=query(Referrals!A:O, "select * where C is not null order by D Offset 1")
That seems to fix some of the issues I've come across.
EDIT:
What about using a filter formula?
=sort(FILTER(offset(Referrals!$A:$O,1,0),offset(Referrals!$C:$C,1,0)<>""),4,true)
If using Apps Script, then you can directly insert a row (via Sheet.insertRows(rowIndex, numRows)) into the sheet at the desired index. But I believe you can achieve what you want by mapping the data in "next spreadsheet" to the names imported via "query" using VLOOKUP. That way when new data is added to "first spreadsheet" it will be sorted accordingly with your formula, but now the data associated will move rows to continue matching their respective row.

Data Validation Dropdown With Filtered Data Range

I'd like to use data in column D
For a drop down in another sheet (data validation)
Only items where column A is less than 9
I tried List from a range
But it looks like you cannot put a formula in the range box
e.g.
=FILTER(GrpsTY!D2:D, GrpsTY!A2:A < 9)
Any suggestions?
formulas are not supported in data validation. the best course of action is to create a helper column with your filtered entries and then feed it to data validation.
Maybe they have added the functionality since the most recent answer (last July, 2020)?
I'm trying to figure out a formula that will let me validate data using a filtered list, and stumbled onto this:
This image shows that Google Sheets supports data validation using a custom formula
For Criteria, select "Custom formula is" instead of the default, "List from a range".
Hope this helps anyone who comes after me :)

Filter Results in One Worksheet Based on the Selection in Another Work Sheet in Tableau

I am new to Tableau and I am trying to filter the results in one sheet based on a selection made in another worksheet. Below, I provide a basic outline of the problem in general terms.
Suppose I have a Sheet A and I filter on dimensions C1 and C2. Based on this I get 10 rows of my data (the original data is 100 rows, suppose). Now, I want to display only the values corresponding to these 10 rows in another worksheet B but filtered on a column C3 (not the original columns C1 and C2), i.e., I want to select the 10 different values in Column C3 and show results in sheet B corresponding to these values.
I tried Filter Action but it seems I can create filters based on the filters I have chosen on Sheet A, i.e., C1 and C2. How can I create a filter corresponding to column C3?
Thanks for your help. Please let me know if the question is too general or not clear.
I didn't totally understand your question but will try to help with whatever I understood.
You can create a filter for Column 3 in the second sheet and when you use action filter in Sheet 1 in dashboard it shows the data based on the action filter and also the filter for Column 3 set for sheet 2.
You can also use parameter.Firstly create a parameter for column3. Create a calculated field using that parameter and use the calculated field as input for the graph or table you create in sheet 2.
Refer these links for calculated fields and parameter:
https://www.interworks.com/blog/rcurtis/2016/05/26/tableau-deep-dive-parameters-calculated-fields
https://www.interworks.com/blog/anonymous/2012/03/26/how-create-and-use-parameters-tableau

Resources