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

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.

Related

Copy entire rows that has unique value on Excel

I have a table with several rows which may contain an equal value (specifically the product code) I have to create another table with a summary of the quantities of the products, so for example, if I have 3 identical products in table 1, in the summary table I only need to have one time that product code with a column that will show me quantity = 3 and the other columns must be filled in with the other product information, on google sheet I managed to do it with this formula: =unique(query(scan!b5:j,"select b,c,d,e,f,g,h",1))
EXAMPLE
how do I do this with excel functions?

Create Pivot Table in Excel with 1 column per item

I have an Excel sheet with the following columns:
Customer ID
Date
Purchase Status (values = success, fail, pending)
Maximum number of rows with the same Customer ID is 4
I'd like to turn it into a table (pivot table?) where I have 5 columns:
Customer ID
Purchase 1
Purchase 2
Purchase 3
Purchase 4
That table should have 1 row per customer ID
Purchase 1 Column should show the purchase status for the customer's first purchase (based on earliest date from the Date column)
Purchase 2 column should show the purchase status for the customer's second purchase, etc.
If the customer only had 2 purchases, then only Purchase 1 and Purchase 2 columns should be populated.
So my table would look something like this:
sample table
Would really appreciate any help on how to do this. Thanks!
Here is an example on how to do this...
Data
Click on Insert -> Pivot Table, select table range and where you want the data to go and select the check box - Add this data to data model
You will see the Range in the pivot table field above all the column names -> Right click and select Add Measure.
This will open a new window. Add the Measure Name (PassFailPending in screen shot below)
In the formula section, add =CONCATENATEX(Range,[Purchase Status],", ")
Click on Check DAX formula to make sure the formula is good
Drag the various columns as you would normally create your pivot table as in screen shot below with the formula as the values...
This will create the table. As the totals don't look good, you can ...
Go To Design Tab > Select Grand Totals > Off for rows and columns
This will given below output

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.

Spotfire: calculated column based on column in another table

Is it possible to insert a calculated column (table 1) based on another table (table 2)? Prefer to do it this way instead of joining table because the data on table 2 may keep on changing.
Calc column is derived by taking the f1 value on Table 2 based on matching value from col X on Table 1 to the nearest p1 value of Table 2. If it is possible to do a calculated column based on another table, how do I create an expression for it?
#p.ysl - In order to add column 'f1' to Table 1, Columns 'x' from Table 1 and 'p1' from Table 2 should be matched. As the format of these columns are not the same (one is real and the other is integer), we cannot match them. Though we do, 'f1' added to Table 1 will be blank as the values don't match.
You can add a calculated column to Table 1 with round values. example: 29.23 will be 29 in this column and then add column 'f1' from Table 2 by comparing calculated column 'round(x,0)' from Table 1 and column 'p1' from Table 2. But, the issue is calculated columns cannot be used for relating tables.
One solution is to freeze this calculated column in order to use it for matching columns. But, when we freeze the column, the entire table will be embedded and data cannot be refreshed.
However, you can accomplish this with an R-script.
Go to Register data function under Tools menu:
In the script section, add below script.
t3 <- cbind(t1, round(t1,0))
In Input Parameters section, define what 't1' is.
In Output parameters section, define what t3 is. In this case, the result will be stored as a table.
Now, RUN the script
It will prompt you to assign input and output parameters. Input - assign column 'x' from table 1.
Output parameter will be a new table.
Note: You can save this data function if you want to.
Table 't3' is created. Now, you can add 'f1' column from Table 2 to this table by matching 'column2' and 'p1' as shown in the screenshot below.
To ensure this runs dynamically, Table 1 and Table 2 can be embedded but t3 table should be linked to source so that when new data gets added to Table 1/ Table 2, t3 will be updated automatically.
Hope this helps!

Left outer join sum with DAX

I have 2 tables:
Fact sales table (sales)
Dimensional period table (dimperiod)
I have joined them through my model on the Period column. However, when I display the sales sum I got this.
I would like to have a row where no sales were made with a sum equal to 0. As below:
I've used the following DAX but didn't work.
CustomSales:=CALCULATE(SUM([Sales]), NATURALLEFTOUTERJOIN(sales,dimperiod))
Just change the pivot table to display blanks.
Or add 0 to your measure. Pivot tables do not display blanks by default. The first option above forces the pivot to display blanks, but you'd need to set this per pivot table. Addition implicitly coerces a blank to a numeric type.
SumSales:=
SUM( 'Sales'[Sales] ) + 0

Resources