I'm brand new to Google Sheets. But how would I make a chart dynamic to this table here? I want to include a dropdown menu that has stuff like: "Last Year", "Last 6 Months" and then filter it by category. I was thinking of maybe using =filter(), but wanted to get some input
I tried using =filter(), using a pivot table, but I'm just lost.
Related
I am trying to create a sheet to determine the amount of overlapping hours for employees.
I have one table with timeclock data for the Employees.
Table 1
And another with timeclock data for their Support Staff.
Table 2
This is the desired output. Each row from table A has all the date matches from table B. From here I would compute the number of overlapping hours in the final column and then roll that up into another sheet.
Table 3, Desired Output
(apologies for image links, I can't post inline images yet)
Sample sheet here Please let me know if you have any ideas for me!
I know its a combination of QUERY, ARRAYFORMULA, FILTER and more but I just can't find the right combo.
Here's a way of doing this type of join using only built-in functions:
=arrayformula(lambda(employee,support,
lambda(datecomp,
lambda(rows,
{vlookup(index(rows,,1),{row(employee),employee},sequence(1,columns(employee),2),false),
vlookup(index(rows,,2),{row(support),support},sequence(1,columns(support),2),false)})(
split(filter(datecomp,datecomp<>""),"|")))(
flatten(if(index(employee,,1)=transpose(index(support,,1)),row(employee)&"|"&transpose(row(support)),))))(
Employee!A1:D6,Support!A1:E5))
There's a lot going on here, but the basic idea is that we are comparing the date columns of each table against each other in a 2D IF array, and where the dates match we are obtaining the row index of each table. After some manipulations we can use these row indexes on each table in two side-by-side VLOOKUPs to obtain the joined table.
DMac,
I wrote myself a QUERY replacement custom function that uses real SQL select syntax.
For your data it looks something like (You need a tab called employee and a tab called support for this to work) :
=gsSQL("select * from employee full join support on employee.date = support.date")
See my test worksheet: (line 164 on gsSqlTest sheet)
https://docs.google.com/spreadsheets/d/1Zmyk7a7u0xvICrxen-c0CdpssrLTkHwYx6XL00Tb1ws/edit?usp=sharing
You need to add one Apps Script file to your sheet to give you the custom function:
https://github.com/demmings/gsSQL/blob/main/dist/gssql.js
For more help using more features see:
https://github.com/demmings/gsSQL
For example, changing the column titles, it would be like:
select employee.name as name .... (rest of your select).
I am trying to build a database of all the technology resources we have in our company. I would like to have a search table on another tab where a user can narrow down what they are looking for using a few drop down menus. For example, they could choose "Laptop" from the "Equipment" drop down, and the list would populate with all the Laptops in the company. They could then select "Las Vegas" from the "Office" drop down, and it would populate with all the laptops in the Vegas office.
I have been using the FILTER formula with various forms of logic. When I use AND, it's considering the blank cells from the unused drop downs, so it returns #N/A since it can't find any rows matching the selections plus a lot of blank cells. When I use OR, I end up getting nearly everything from the database.
I've tried using both AND and OR together, incorporating IF statements with <>"", as well as various variations incorporating all three of them, but nothing has worked. I'm at a bit of a loss. Is there any way to get FILTER to ignore the cells that are blank?
Link to a sample spreadsheet is here.
use:
=ARRAYFORMULA(QUERY({Inventory!B4:I}, "where "&TEXTJOIN(" and ", 1,
IF(C3:C10="",,"Col"&ROW(B3:B10)-2&" contains '"&C3:C10&"'"))))
Try this in Search!E3:
=FILTER(Inventory!B4:I1000,if($C$3<>"",(Inventory!B4:B1000=$C$3),Inventory!B4:B1000<>$C$3)*if($C$4<>"",(Inventory!C4:C1000=$C$4),Inventory!B4:B1000<>$C$4)*if($C$5<>"",(Inventory!D4:D1000=$C$5),Inventory!B4:B1000<>$C$5)*if($C$6<>"",(Inventory!E4:E1000=$C$6),Inventory!B4:B1000<>$C$6)*if($C$7<>"",(Inventory!F4:F1000=$C$7),Inventory!B4:B1000<>$C$7)*if($C$8<>"",(Inventory!G4:G1000=$C$8),Inventory!B4:B1000<>$C$8)*if($C$9<>"",(Inventory!H4:H1000=$C$9),Inventory!B4:B1000<>$C$9)*if($C$10<>"",(Inventory!I4:I1000=$C$10),Inventory!B4:B1000<>$C$10))
To explain what I want to do, I will show a much simpler version of my spreadsheet:
I want to be able to filter the Tags to filter column using multiple value of the column Filters available.
For instance, if I select the filters available e and d, I will get back only the lines 15,15 and 17.
My problem is that I don't know how to select the filters that I want and filter the table.
The perfect solution would be to have a list with checkboxes like the one shown in the following picture:
But instead of showing the exact values in this column, it should show the ones in the Filters available table, and after it would filter to show the lines that contains at least one of the options selected...
Do you think I made my question clear?
Try using one extra column with filter condition:
In this sample:
Range A2:A8 = filters available
Range B2:B8 = range where user selects, which filter to use, pasting ones.
Range D2:D9 = tags to filter
Range E2:E9 = extra column with condition
You need only one formula in cell E2:
=ArrayFormula(REGEXMATCH(D2:D9,JOIN("|",FILTER(A2:A8,B2:B8=1))))
ArrayFormula will make it expand down to row 9 automatically. Select your range instead of D2:D9.
REGEXMATCH checks if tags contains selected filters.
JOIN makes string like this: "a|c|e|g" which makes REGEXMATCH to check for any of selected filters: a OR c OR e OR g.
A very easy way of doing this it to use a Pivot Table.
Highlight the data you want to use, then select Pivot Table from the Data menu.
Then Add field to select the Rows and Columns you are after, and include the column you want to filter by in the Filter field
Then you can use the built in Pivot Table Filter to show what you are after.
Giant image showing how to setup and use a pivot table in google sheets
here is a link to the google help for how to create a pivot table:
Link to google help tutorial for how to use pivot tables
I'm using Ransack for some simple searching of one of my models.
I would like to add a dropdown to the search with entries like 'Today', 'Yesterday', 'Current week', etc which would operate on the created_at field. Also it would be nice to have an entry in this dropdown to reveal 2 date boxes to pick a custom date range. How do I go about this?
One way that I can think of doing this is for the dropdown to populate the two (hidden) date boxes via JavaScript, I just don't know how I could easily reselect the proper entry in the dropdown when reloading the page.
use this
distance_of_time_in_words(obj.created_at,Time.now)+" ago"
This will return result like this:
about 2 hours ago
I have three columns in my table product name, product color, and product brand. The table is pretty much static, I just import the data once and it does not get modified. An example would be small car, red, motor co. I want to be able to search for and get a result for "car red".
If I use
name_or_color_or_brand_contains
I do not get any results.
Is there a way to collapse the three columns during the search or is creating a column that has the info of the three column a possible solution seeing that my data does not change that much.
Thanks!