How to sort through table using a sublist of criteria in excel - excel

I have a table of data with 5 columns A B C D E. Under column A are values ranging from 1 to 1000 (with repeats and no blanks), and columns B to E have data relating to that number. How do I sort this table if I have a predefined list in mind, let's say I want to see only the data relating to numbers 5, 8, 15, 100, 150...etc. How would I be able to sort it with a custom list?
Let me know if further clarification is needed.

I found a solution after tinkering around.
I went into into data > advanced and selected my whole table ($A$1:$E$2000) as the "List range" and put down my list of criteria (the numbers I'm sorting for from column A) in column F as the "Criteria range". You need to enter A's header as the header of your list of criteria or else it won't work.

Related

Google Spreadsheet/ Excel - how to find matching values in column A, having necessary values in column M

I have list of product articles in column A, in the columns B to L I have additional info on the products, total 95000 lines. I also have column M which lists 3000 articles which I need to find in the list from column A. How do I highlight only matching values in column A that are present in column M?
I tried conditional formatting but the file size is too big and all actions take too much time.
try this:
=COUNTIF($M$2:$M$5;A2)
it will give a 1 if the product is in the column M list, and a 0 if it isn't.
you can then filter on column N having 1.
Be mindful on your data set, the actual formula you have to use will probably be more like:
=COUNTIF($M$2:$M$3000;A2)

Excel Pivot Table Output-how to designate it to appropriate cells on another worksheet

I have a list of about 4,500 patients and 4,000 ICD Codes. I used an Excel Pivot Table to count and sort the number of times they were diagnosed with specific codes. My objective is to list each patients top three diagnoses(by count) in a spreadsheet.
I am stuck on how to transfer the pivot table results to the spreadsheet.
Here is an example of what my data looks like, columns A and B are what I have, columns D thru G are what I would like to end up with:
Columns A and B aren't in a great format to work with and you could probably create a pivot table that looks like D through G instead, but working with what you've got I propose the following:
=INDEX($A:$A,MATCH($D2,$A:$A,0)+1)
=INDEX($A:$A,MATCH($D2,$A:$A,0)+2)
=INDEX($A:$A,MATCH($D2,$A:$A,0)+3)
In columns E, F, and G, respectively.
What this does is search the column for the name and the shift down 1, 2, or 3 columns for the most, second most, and third most used Dx. This assumes the counts are sorted in descending order.

Excel - how to look in a dynamically changing range of multiple rows and columns and retrieve data

I have 2 excel files. 1 is a workfile in which I work, the other is the output of a database. See pic 1 for my database output (simplified).
What we see here:
The purchase order numer in column A
The row in the database in column B
The status of the row in the database in column C
The classification in column D, where W means a product we want to measure and P meaning delivery costs, administration costs etc (we don't want to measure this)
The number of items ordered and the number of items delivered in column E
The company name and product info in column F
Now, what I want, is something like this:
I want this table to be filled automatically based on the database output. It works for column B, but I'm stuck on column C, D and E.
What I want from you!
I need help with column C, D and E.
Number of rows: it needs to calculate the rows only with W in column D. So for item 4410027708 it has to be 2 (only 2 rows with W) and for item 4410027709 it should be 1.
Items ordered: it needs to add-up all the values that are directly to the right of the W in column D. So, for 4410027708, it needs to add up 3 and 5. It must ignore all the rows with P!
Items to be delivered: You may already guess this, but it needs to add up all the values in column E that are on the same row as column C with To be delivered, but only for the W rows (not the P versions). So, for item 4410027708 this should be
I suggest easy if ColumnA can be filled down first (including for the last entry) then assuming the database output sheet is called Sheet1, in:
C2: =COUNTIFS(Sheet1!A:A,A2,Sheet1!D:D,"W")
D2: =SUMIFS(Sheet1!E:E,Sheet1!A:A,A2,Sheet1!D:D,"W")
E2: =SUMIFS(Sheet1!E:E,Sheet1!A:A,A2,Sheet1!C:C,"To be delivered")
copied down to suit.

How to use a VLOOKUP as a criteria in SUMIF?

First allow me to provide some background:
I have two tables, the first with one column that has a key value, which is just one letter of the alphabet and a second column with values that later I want to sum. The second table also has two columns. The first contains a list of the distinct values from the key column of the first table, and the second contains a binary value of 1 or 0. Examples below:
Table 1: Table 2:
A 50 A 1
A 50 B 0
B 100 C 0
C 125
The binary values in Table 2 are variable based on other information contained in my workbook. Now what I want to do is to sum all of the values in Table 1, where the Primary key is "turned on" in Table 2, aka the value in the second column is 1. I've tried multiple iterations of using SUMIF and VLOOKUP and LOOKUP as the criteria but can't get anything to work. Can anyone help out with a way, either using VBA or in the cell formula itself, to get this done?
Thanks in advance.
How's this? Place this next to the 1 or 0 in your Table2, =IF(F1>0,SUMIFS($B$1:$B$4,$A$1:$A$4,E1),""):
and if you drag that down, it'll return blanks for the "letter" that doesn't have duplicates.
Edit: Or, per #pnuts, this =SUMIF(A:A,"="&INDEX(E:E,MATCH(1,F:F,0)),B:B)

How to get uniques in column A and totals from column B?

I have a spreadsheet that looks like this:
A B
DeptA 10
DeptB 5
DeptA 5
DeptA 10
DeptC 5
DeptB 10
DeptA 20
DeptB 5
I'm trying to get a list of the unique values in A, and then the total in B for each unique value. The output I'm looking for is this, which can go in columns C/D (or wherever, doesn't matter)
DeptA 45
DeptB 20
DeptC 5
I know I can pull the uniques in A and place them in C with the following array formula:
=INDEX($A$2:$A$8, MATCH(0, COUNTIF($C$1:C1, $A$2:$A$8), 0))
How to list the column B totals along with it?
No formula is necessary.
For example, uniques may be obtained (avoiding COUNTIF, INDEX and MATCH) with Data > Sort & Filter – Advanced , Copy to another location selected, Unique records only checked and Copy to: set to C1 (though my version is a bit temperamental and at present also requires deleting C1 and sorting).
But with sorting (select A:B, Data > Sort & Filter – AZ) then subtotal can be used (insert a new row as Row1, select A:B Data > Outline – Subtotal, OK , OK [defaults are probably as required: At each change in: (Column A), Use function: Sum, Add subtotal to: (Column B), Replace current subtotals, Summary below data] then click on small ‘2’ at the top left.
Grand Total is a bonus.
You might want to use the DSUM Function as it's less work than pivoting.
EDIT: Corrected URL
You can keep your current construct and do a sumif or sumifs (they have different order of the arguments) in column D based on column C that sums column B.
Alternatively you can use a pivot table to get the complete result for you. Note however that a pivot requires manual refreshing, where the formulas will auto update when calculation is set to automatic

Resources