Is there a way to filter or query unique results where unique is determined by one column but all columns are returned? - google-sheets

My data source range is A:AK (A6:AK1478).
The data is content (blogs, videos, etc) titles, authors, ratings, etc.(A:J) and values for how they map to categories (K:AK).
A:J is text data.
K:AK is numerical data.
There are duplicate entries I cannot remove. The title of each piece of content is in column F; this is the only column I look at to determine duplicate values.
I want to query or filter (which is better?) all of this data into another sheet in order to obtain actual sums from columns K:AK. I want the formula to:
Return all columns and rows from original data, AND
Disregard duplicates only in column F
I do not want to delete duplicates from the original source.
So far I have tried query and filter but no luck. I'm not an expert at advanced formulas, so any advice would be much appreciated!!
I'm very sorry also that I cannot share this spreadsheet as it is work-related. I'm happy to answer any questions I can though.
I have tried =unique(query() and =unique(filter() but this doesn't work because I can't figure out how to set column F as the range to look at for duplicates AND I want all columns returned, not just column F.
update: Here is a screenshot of my current query output

try it like this - instead of UNIQUE use internal QUERY parameter group by:
=QUERY(DLEs!F6:AK1478,
"select F,sum(G),sum(H),sum(I),sum(J),sum(K),sum(L),sum(M),sum(N),sum(O),sum(P),sum(Q),sum(R),sum(S),sum(T),sum(U),sum(V),sum(W),sum(X),sum(Y),sum(Z),sum(AA),sum(AB),sum(AC),sum(AD),sum(AE),sum(AF),sum(AG),sum(AH),sum(AI),sum(AJ),sum(AK)
where F is not null
group by F", 0)

Related

Is there a formula to resolve duplicates in one column by looking at a second column?

I have a google sheet with 2 columns, A (containing names) and B (containing dates).
there are quite a few duplicates in A which I need resolved by looking at B and selecting the row with the soonest date.
Ideally I need to extract the data to make a list on another sheet with no duplicates, being resolved by the above method. the issue is that there might be new rows added to the sheet, and I need the new rows checked against the existing data to confirm it has a sooner date compared to potential duplicates. how can I formulate this?
There is probably a better way, but I just use the query function to put the results in a different sheet so I don't mess with the source data.
=QUERY()
Here is some examples on how it is used: https://support.google.com/docs/answer/3093343
As for the query itself, something like this should work. A being the first column (Name), and B being the second column (Date).
SELECT A, MAX(B) GROUP BY A

Unique Filter multiple sheets with ArrayFormula

I have no idea how to title this post, apologize in advance.
I have several sheets with a number in Column I and a name centered and merged in columns A:H. I want to obtain the name from A:H of the corresponding value within I but do have duplicates, therefore I need the nth value when permitted. The formula I have so far works up to the point it does not autofill down as an ArrayFormula, so when I drag the formula down I get an #REF! error due to the fact that when a duplicate is found it cannot overwrite the formula below.
This will be easier to showcase: LINK TO SHEET.
Essentially, in the main sheet all the values in I:I of all the other sheets are obtained and sorted, then using that column I want to return the name that corresponds to the value, allowing for duplicates to work themselves out. I believe my issues resides in the $B1 part at the end of the formula preventing it from being an array.
=ARRAYFORMULA(UNIQUE(FILTER({Sheet2!$A$1:$A;Sheet3!$A$1:$A;Sheet4!$A$1:$A},{Sheet2!$I$1:$I;Sheet3!$I$1:$I;Sheet4!$I$1:$I}=$B1)))
Cell F2 on the Sheet1 tab:
=QUERY({Sheet2!A:I;Sheet3!A:I;Sheet4!A:I},"select Col1,Col9 where Col9>0 order by Col9 asc",0)
You can read more about query here.

Total Value based on Group cross reference? (Google Sheets)

I'd like to query a couple of tables to come up with a total sum of the value of a set of items, but with the price being dependent on data in another cell range, then grouping it based on category.
For example, say I have a data table containing name, category, and price of some grocery items. Another table I store my current inventory of groceries. I would like to calculate the value of, say, all my fruit.
Here is an editable example:
https://docs.google.com/spreadsheets/d/1y2fLgwrsMr-dWojy3uYZ1Qs2U01AP3RlT_PI2txwZRE/edit?usp=sharing
Not sure the best way to approach this?
Thanks for any guidance!
Solution
Use VLOOKUP for searching the right item of your inventory and then multiply it with the value of the product you made the search with. For more info about VLOOKUP check this documentation.
=VLOOKUP(E3,$A$3:$C$11,3,FALSE)*F3
With these values, create a column next to Quantity indicating the total price for each product (as show in the picture below). Then, create another column with the Type of each item performing a similar VLOOKUP formula:
=VLOOKUP(E3,$A$3:$C$11,2,FALSE)
Finally, use these two columns as input ranges to apply a SUMIF formula for adding up the items of each group:
=SUMIF(H3:H6,"Fruit",G3:G6)
For more info about SUMIF check this documentation.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Google Sheets: Group Values in rows based on duplicate value in column

I am trying to sort Google Sheets data in columns.
Raw Data
Desired Output
I know that this can be offered with some time of QUERY function but I cannot get it to work exactly how I want. I have already read through this thread on Google Sheets and this thread on Excel.
I don't think query can do exactly this: it can aggregate data in a few ways, but not in the way of "take the values and arrange in a row". I would use unique and filter for this purpose. Assuming the input columns are A,B and the output columns are C, D,... the formulas would be
C2: =unique(A2:A) to return the team numbers without repetition
D2: =transpose(filter(B2:B, A2:A=C2)) to return the matching scores, transposed to become a row.
The formula in D2 needs to be copied/dragged down the D column.

Filter by multiple values

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

Resources