I have two tables in excel(sheets) . One has 10,000 entries , another has 1000 entries . Both of them have account number column in common . I want to select only those row in 10,000 entries which have their account numbers specified in 1000 entries table. An easy way is preferred .
Use advance filter as stated in the comments.
Go to: Data -> Sort & Filter -> Advanced
Select Filter the list, in-place
Select the 10,000 list account numbers as List range
Select the 1,000 list account numbers as Criteria range
That should provide the list you are looking for. No sql needed.
Related
I'm using Google sheets, and I want to get the data from one sheet to another where I want only the columns with count > 1.
Let's say we have 3 columns A, B, and C. I tried the following (the first sheet name is "Form Responses 1"):
I thought about using a query in the second sheet as: =query('Form Responses 1'!A1:Z, "Select A having count (A) >1 union select B having count (B) >1 union select C having count (C) > 1"). But I got a parse error where it seems that union and having are not supported in google sheets query.
How can I achieve this (whether it's using query or any other Google sheets function that can work)?
More details:
The first sheet contains info about exercises conducted during a lecture and it gets its data from a Google Form (so the responses are fed in this sheet). Here is a screenshot of it:
Please note that the form is divided into sections. When the user selects the course, the attendance, the participation, and adds a comment, then they go to the next section, the next section will be based on the selected course, the newly opened section will have the exercise name and rating questions (the exercise name is a dropdown list with items that are prefilled and specific to the selected course). That's why, you can see that "exercise name" and "rate the exercise" columns are repeated because we have 2 sections in this form.
The second sheet should contain the data of a selected course only (either mobile dev or web dev) which can be achieved easily through a query with a where clause. But, in addition to that, it shouldn't contain the empty columns of "exercise name" and "rate the exercise" as they correspond to another section. So, it should have only one exercise name column and one rating column that correspond to the selected course. Here is a screenshot if we only use a query with where clause without removing the extra name and rating columns:
Here is a screenshot with the desired result:
Thanks.
why not use just:
=QUERY('Form Responses 1'!A1:Z, "select A,B,C,D,E,F,G where F is not null", 1)
Use "OR" condition
Eg:-
QUERY(Data!A:R,"select A, N, P where N>0 or P>0")
where A column has country and N, P columns have population values
I'm using excel 15.32 on Mac and am doing a database connection to my company's MySQL database. It is the "database" option and not the "SQL server ODBC".
My query looks something like:
SELECT COUNT(requisition_item.qty)
FROM requisition_item
INNER JOIN requisition
ON requisition.id = requisition_item.requisitionId
WHERE requisition_item.itemId IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND requisition.requiredBy >= '2016-08-01'
And in parameters I map EACH "?" to a specific cell. Is there a way to make that cleaner? Can I map to a range for a count function? It's a pain to map each one especially as my list grows!
EDIT: I am counting how many times a group of numbers (located in ColA of an Excel spreadsheet) appears in my requisition_items table. I map each "?" (Excel names them Parameter1, Parameter2, etc.) to each ColA cell (A1, A2, etc.) The query simply outputs a count of how many times each value that I type in ColA appears in that table.
I am trying to determine what the fewest amount number of markets that render highest amount number of unique products. I'm not sure how to get perform DISTINCT Product Counts with every combination of market.
I can put my data in SQL tables if it's easier with a query.
Here is sample data of what I'm trying to achieve.
Attempting to clarify: Essentially, I'm trying to get all the combination of markets and determine what the distinct count of products are. From there I can derive percentages.
Example:
CHI: 4 DISTINCT PRODUCTS
CHI/LA: 5 DISTINCT PRODUCTS
CHI/LA/MIA: 8 DISTINCT PRODUCTS
To count the unique products for a single market it's a scary formula with curly brackets.
I've setup the formula to work on your sheet so try putting it in cell C2 and press CTRL+SHIFT+ENTER to make it an array formula when you input it.
=SUM(IF(FREQUENCY(IF($E$2:$E$18<>"", IF($E$2:$E$18=B2, MATCH($F$2:$F$18, $F$2:$F$18, 0))), ROW($F$2:$F$18)-ROW($F$1)+1), 1))
You should be able to autofill down to the see the rest of the unique values for the markets you have listed in column B.
Getting the list of markets is complicated but someone asked the question before so check out this answer Creating a list of all possible unique combinations from an array (using VBA)
I'm using a Pivot Table in Excel 2010, and while searching posts I find that a lot of users are frustrated like me because it doesn't keep all formats.
So what I'm trying to do is run a macro that formats columns in a Pivot table, but limited to the last row and column in the table. I have the formatting info, but I just need to know how to apply it to specific columns and rows.
What I was thinking might work is finding the last column of the Values row, in this case "Stops per Rte" which is the last Values column; however, I have months listed at the top, so it repeats across months. If the user filters only certain months then the # of columns will decrease.
Same goes for the # of rows: of course, the user should be able to expand/collapse rows as needed, so I only want the column format to go to the last row or just above "Grand Total", if possible.
Hopefully, this makes sense. Thanks in advance! = )
Summary:
I have a list of work items that I am attempting to assign to a list of workers. Each working is allowed to only have a max of 100 work items assigned to them. Each work item specifies the user that should work it (associated as an owner).
For example:
Jim works a total of 5 accounts each with multiple work items. In total jim has 50 items to work already assigned to him. I am allowed to assign only 50 more.
My plight/goal:
I am using a temp table and a select statement to get the # of items each owner has currently assigned to them and I calculate the available slots for new items and store the values in new column. I need to be able to select from the items table where the owner matches my list of owners and their available items(in the temp table), only retrieving the number of rows for each user equal to the number of available slots per user - query would return only 50 rows for jim even though there may be 200 matching the criteria while sam may get 0 rows because he has no available slots while there are 30 items for him to work in the items table.
I realize I may be approaching this problem wrong. I want to avoid using a cursor.
Edit: Adding some example code
SELECT
nUserID_Owner
, CASE
WHEN COUNT(c.nWorkID) >= 100 THEN 0
ELSE 100 - COUNT(c.nWorkID)
END
,COUNT(c.nWorkID)
FROM tblAccounts cic
LEFT JOIN tblWorkItems c
ON c.sAccountNumber = cic.sAccountNumber
AND c.nUserID_WorkAssignedTo = cic.nUserID_Owner
AND c.nTeamID_WorkAssignedTo = cic.nTeamID_Owner
WHERE cic.nUserID_Collector IS NOT NULL
AND nUserID_CurrentOwner = 5288
AND c.bCompleted = 0
GROUP BY nUserID_Owner
This provides output vaulues of 5288, 50, 50 (in Jim's scenario)
It took longer than I wanted it to but I found a solution.
I did use a sub-query as suggested above to produce the work items with a unique row count by user.
I used PARTITION BY to produce a unique row count for each worker and included in my HAVING clause that the row number must be < the count of available slots. I'd post the code but it's beyond the char limit and I'd also have a lot of things to change to anon the system properly.
Originally I was approaching the problem incorrectly focusing on limiting the results rather than thinking about creating the necessary data to relate the result sets.