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

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.

Related

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 sort through table using a sublist of criteria in 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.

Excel Complex Conditional

Ok so I did this in LibreOffice but now I have to duplicate it to excel for my Pay Roll department since they use excel. So I am having to figure out how to convert the formulas to Excel. This is only 1 of two totaling formulas that did not convert when I saved it as Excel format.
I have the following sheet called DailyReport
I am currently calculating Column M with =SUMPRODUCT(A2:A200=A2, G2:G200)
Then on a secondary sheet I have the following second sheet WeeklyReport
Now what I want to do is if WeeklyReport Column A2 == DailyReport Column A then take the date in DailyReport Column B and test it to fall in the date range in WeeklyReport Column B and Column C with =IF(AND(DailyReport.B2>=B2,DailyReport.B2<=C2),1, 0) and if that is true add the Total Daily Hours to the total in WeeklyReports Column D from DailyReports Column M
I hope this is clear enough if not please let me know what else I can do to make my question more clear.
Thanks in advance!
So, to me it sounds like:
You want a sum of all hours, for a specific employee (defined by the A column value weekly report), in between the dates specified (also defined by weekly report, b & c column) - and you want the end result to be in WeeklyReport column D and all of it to relate to the same row as the result?
sumproduct will do the trick. I am renaming your sheets to DR and WR for my sanity's sake.
=sumproduct((DR!G$2:G$200)*(DR!A$2:A$200=A2)*(DR!B$2:B$200>=B2)*(DR!B$2:B$200<C2))
Now, if you want a new daily report sheet every day it gets a bit trickier to do with formulas alone, you should then have a macro to store the "current" value and add the "new" value, or for simplicity's sake create more columns (one for each working day) and duplicate the formula to all daily columns, or have as many named dailyreports as there are working days in a week and increase the formula to check multiple sheets. I would add columns - least amount of work and the dumbest solution often proves the most resilient.
Did that help in any way?

Excel Data Manipulation with alphanumberic data

I have two columns in Excel. We can say that column 1 and column 2. Both columns have alphanumeric data i want to minus column 1 from column 2. How can i do that.
Example:
column 1 column two result column
ab ab ad
ac ac
ad
Thanks
There are more sophisticated/cleaner ways to do this, but I'd enter this formula into column C (update your ranges accordingly to capture each list), and then sort the result column:
=IF(COUNTIF($A$1:$A$8,$B$1:$B$4)=0,A1,"")
This compares the list in $A$1:$A$8 to the list in $B$1:$B$4 and places the "differences" in the result column C. I'm assuming that sorting is permissible. But like I said, there are VBA solutions that could do this a little more cleanly.

Excel - trying to identify top 3 sales numbers in column d, and return information from corresponding column a

Excel - trying to identify top 3 sales numbers in column D (D5:D:41), and return information from corresponding column A (A5:A41)
You can get the top 3 with
=INDEX($A$5:$A$41,MATCH(LARGE($D$5:$D$41,ROW(A1)),$D$5:$D$41,0))
Copy down two rows.
You could use a pivot table to very easily get his information.
Select insert a pivot table
Select your data
In the pivot table window place the 'Name' field into the 'Row Labels' box and the 'Sales' field into the 'Values' box.
This should give you a pivot table with a list of people and the sum of their sales, making it very easy to see who comes out top.

Resources