Copy entire rows that has unique value on Excel - 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?

Related

Multiply and Sum Data from 2 tables based off of Multiple Criteria

In one formula, I am trying to multiply and then sum up data in 2 different tables based off of criteria selected for both tables.
So, if the user picks data from column 1 in the first table but column 3 in the second table, I want to use the corresponding amounts. I tried using Sumproduct but couldn't get it to work.
I used =SUMPRODUCT(ExpenseBase * ExpenseMultiplier*(ModelTypeBase=Type)*(MultiplierTypes=Multiplier))
ExpenseBase is the data in table 1, ExpenseMultiplier is data in table 2, ModelTypeBase is the top labels in table 1 and MultiplierTypes is the top labels in table 1. If I choose X and A, I get the right answer, but if I choose B in the second table it goes to 0.
Base Tables
[1]: https://i.stack.imgur.com/S72yY.png
Use INDEX to return the correct column
Capital:
=SUMPRODUCT(INDEX($B$3:$D$10,0,MATCH($B$17,$B$2:$D$2,0)),INDEX($G$3:$I$10,0,MATCH($B$18,$G$2:$I$2,0)))
Then for Expense we change the lookup ranges:
=SUMPRODUCT(INDEX($B$12:$D$14,0,MATCH($B$17,$B$2:$D$2,0)),INDEX($G$12:$I$14,0,MATCH($B$18,$G$2:$I$2,0)))

How to count the number repeated product purchased by the same customer based on

I have a table with
customer identifier (email)
order number (1 refers to the first order one has placed, 2 is the 2nd)
SKU is the product identifier.
I want to see a table that has two columns:
SKU
the number of times this product has been showed in both the 1st and 2nd order of the same customer. Or in other words, how many times the product has been ordered repeatedly.
Something like this:
What excel function could achieve this?
You can achieve this with a helper column using COUNTIFS, and then a pivot table:
Helper column formula:
=--(COUNTIFS(A$2:A2,A2,C$2:C2,C2)>1)
Add a value filter to the pivot table to only show rows with a value greater than 0.
You can also create a Power Pivot table to count distinct orders and create a measure to count repeat orders.
Here, column F is the Distinct count of customer and column G is the total count of customer for each SKU. Columns H and I are measures you can create with power pivot.

How to change value of field based on values of two other fields in Excel or Google Sheets

I'm trying to create a customized personal expense report on Google sheets . If anyone has suggestions for a better approach, I'm open to to ideas!
In one column Category, I have option to select category with a drop down - Restaurants, Rent, Electricity etc. The column Value on the next to it holds the an integer value.
On a the same sheet, I have a column where all categories are defined. In the column Limit next to it, is the maximum integer value for each category. The next column Balance holds the remaining value (Limit - Sum of all Value matching Category)
My question is - when I add an entry in sheet 1 for any category with a value, how do I subtract the Value added from the respective Category to show the remaining balance from Limit in Balance column? As I keep adding items, the Balance field should get updated.
TABLE 1
Item Category Value
i1 Rest 100
i2 Rent 50
..
..
TABLE 2 (In same sheet somewhere adjacent to the above table)
Category Limit Balance
Rest 500 400
Rent 1000 950
..
..
Try using this:
=IFNA([limitcellname]-SUMIF([rangeofcategories],[categorycellname],[expensevaluerange]),[limitcellname])
Range of categories = column where all categories are listed in the expenses table. E.g- B:B if B column has expense categories
expense value range = column where all expenses are listed in the expenses table. E.g- C:C if expenses values are in C column
category cell name is the category cell in the balance table
limit cell name is the limit cell
This should work for your purposes

Sumproduct using 2 criterias and on filtered values

I have the following source table
Date | fruit | veg
The user has previously filtered the date by month. In another table, I want to count the number of apples and tomatoes for example. To remove the invisible rows I use the SUBTOTAL function as
=(SUBTOTAL(102;OFFSET(limiter;ROW(limiter)-MIN(ROW(limiter));;1;1)))
where 'limiter' is the date range.
Then to count the number of apples in the fruit column , I use
= SUMPRODUCT(SUBTOTAL(102;OFFSET(limiter;ROW(limiter)-MIN(ROW(limiter));;1;1)) * Table!fruit = "apple"
and it works fine.
But, if I want to add in the vegetables criteria along with the fruit, the result is 0. I tried doing the sumproduct of fruit and veg first and then add the subtotal function but it gave a huge number.
Have you considered using a pivot table? (I strongly recommend you to)
Go to a new tab, select A1 and insert, new pivot table. You can put the fruit field in the column (probably row labels - my excel is in Portuguese =/). You would instantly have a table containing as first colum the list of existing fruits.
Then add the date to the body (probably values) of the pivot table and certify the type of value shown is count.
You would intantly get the count of all fruits.
The great advantage is that you can play around with this table as easily as dragging and dropping fields in columns, rows and body/values and instantly getting the results you want without having to figure out any formula issues.
Pivot tables also allow you to filter not only the date, but any other fields you wish.

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