How to sumif with array or sumproduct - excel

I have some products and each products are made of one or more parts. I attached a sample.
For example, product A is made of one part "a11" and client ordered 10, Product B is made of 2 part "a12" and client ordered 20...... product E is made of 2 part "a15" and 3 part "a16"and client ordered 50.
I have a second table to summarize how many parts in total do I need (E1:F7). I want to do formula =sumif($B$2:$B$7,$E2,sumproduct(C2:$C$7,D2:D7)) to see the total of each part I need but it doesn't work, anyone knows any formula that can help me with this problem?

Related

MAXIFS function that increments to return 2nd,3rd largest numbers

I have a column called Paid which consists of currency figures which is in column A.
I also have a column called ID to uniquely define each of the rows which is in column B.
I am trying to make a top ten list of the highest results from this column.
For the first result, I use a simple MAX function.
For the following, I use
=MAXIFS(Combined!$A$1:$A$2916,$A$1:$A$2916,"<"&$C1)
where C1 is the first result in the top 10 list.
THE ISSUE: Currently, if two results are equal in Paid, one will get skipped and not be on the list.
I've tried using something in the nature of
=MAXIFS($A$1:$A$2916,$B$2:$B$2916,"<>"&$D1)
where D1 is the ID of the 1st in the top 10 list.
My issue here is that I want to use a condition to say that none of the ID's in the B column appear in the above entries in the D column(IDs of the top 10) and I don't know how to do this without brute forcing and writing each cell into each condition.
Is there a smoother way to write a "not in" check in a maxif function?
Thanks
For reference, an example of what I want would look like:
Example Data
Maybe try:
Formula in C2:
=INDEX(SORT(A2:B11,1,-1),SEQUENCE(10),{1,2})
Where 10 is your top N figure.
Note: The above works fine in retrieving only 10 figures, yet if you insist you want top have ID '5' above '3' in rank 2, and ID '9' above '1' for rank 8, then use:
=INDEX(SORTBY(A2:B11,A2:A11,-1;B2:B11,-1),SEQUENCE(10),{1,2})
I could see this being relevant if you have two identical payments "battle" for e.g. 1st or 10th place with one of multiple id's comming short.

Excel: How to assign values to unique combinations/check for unique combinations in large data sets

I'm analyzing sales data in an Excel report. Each row represents a product sold.
ticket product
20190101203045 Eggs
20190101203045 Pancakes
20190101203045 Happy meal
20190101203045 Coca-Cola
20190101203045 Orange juice
20190102144525 All-Bran cereal
20190102144525 Fruit
20190102144526 Lemonade
I have successfully concatenated all products with the same ticket # and separated them into columns:
20190101203045,Eggs,Pancakes,Happy meal,Coca-Cola,Orange juice
20190102144525,All-Bran cereal,Fruit
20190102144526,Lemonade
To test for unique combinations (no particular order) I used a simple and effective approach, assign a power of 2 (1,2,4,8,16,...) number to every individual value (eggs, pancakes, happy meal, ...) so that every unique combination results in a unique value when adding up their assigned values, example:
20190101203045,1,2,4,8,16 = 31 (only this combination will result in 31)
20190102144525,32,64 = 96 (only this combination will result in 96)
20190102144526,128 = 128 (only this combination will result in 128)
This works very well with a small number of values, I would just SUM these values and search for duplicates, but the files I'm analyzing may have up to 2000 different values (products), so this approach no longer works (numbers get BIG).
There are other approaches like using formulas, but the sheets have thousands of rows (too much processing), so I'm looking for a more creative, efficient solution.
Any help is appreciated
From the description of your approach, I believe you can easily do this with Power Query, but it may take some calculation time.
Try to visualize this...
Load your data (2 columns: ticket #, item)
Pivot by column ticket number
Remove column ticket number
Remove duplicate rows
Add new index column, call it Unique Sales
Now you're done. Each row is a unique combination.
(Edit) originally recommended unpivoting as a final step (oops) don't do that.

If match found yes/ no, two different tables, two different values

I did not see something like this in other questions/ forums so hopefully it can be done.
Need to know if values from one table are in another, checking to see if there is a match.
Table 1 in Sheet 1 is used to record "Incoming" data of Part Number and Lot Number.
Table 2 in Sheet 2 is used to record when record is "Outgoing".
Column A is Part Number, B is Lot number in both Sheets. Part number can repeat, but Lot # will not. Trying to find a way to return a Yes/ No or 1,0 if part number and lot number in Sheet 1 exists in Sheet 2 in Column C of Sheet1. I have attached a Snippet example what I am trying to do. This will help me generate info on if an Incoming record has been completed and left (Outgoing). I do not believe vlookup will work and have tried some different permutations of match. Open for other options. Thanks!!
Edit: Lot # does have to ablity to repeat (not often) but with a different corresponding Part Number. Need to know if there is a match with both Lot# and Part Number as in the Incoming record.
Use:
=--(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,B2)>0)
If there are matches it will return 1 if not 0

Sum of Questionnaire Scores Based on a Domain Table

I have created a questionnaire that consists of around 100 questions. Participants are asked to fill them in online, where the items are shuffled each time. These items are separated into 6 domains where, for the sake of easier understanding, let's just call them Domain 1 - 6.
I have them typed in one specific table called "Correspondence", with format like below:
(An example)
Question No.|Domain
   1  |Domain A
   2  |Domain C
   3  |Domain A
   4  |Domain B
   5  |Domain A
   6  |Domain C
I used Google Form to generate a spreadsheet of RAW data of respondents, where it will help me mark the RAW Scores, for each item on a separate column:
(An example)
Submission ID|Question 1|Question 2|Question 3|Question 4|Question
5|Question 6
Participant 1 |  2  |  3  |  5   |  1   |  2   |  4   |
Participant 2 |  5  |  4  |  5   |  3   |  5   |  1   |
Participant 3 |  1  |  1  |  1   |  2   |  2   |  2   |
The next thing I need to do is generate another table that sums up the Domain totals for each participant. So from the example above, I need to sum 1,3,5 as Domain A, 4 as Domain B and 2 & 6 as Domain C:
(An example)
Participant 1
    |Domain A|Domain B|Domain C|
Total |  9  |  1  |  7   |
The hardest thing is to find a proper method to kick start this process. Can anyone point me in the right direction? Either formulas or VBAs would be fine too. Thanks!
This can be done if you are able to create a helper row.
First, I created a table to link the question to domain. That is named in my example as "Correspondence". This table is somewhat the answer key. From your description of the problem, you need a table like this to establish which question is associated with the domain/category/point system you want to use.
I then created a helper row for the survey results shown on row 9. This has =INDEX($B$3:$C$8,MATCH(B$10,$B$3:$B$8,0),2) in cell B9 as the code to reference the question to the domain. This is immediately above the questions in the example, but you can put it on a separate sheet if needed.
Then you can just sum them up.
=SUMPRODUCT(SUMIFS(INDIRECT(MATCH($E3,$A:$A,0)&":"&MATCH($E3,$A:$A,0)),$9:$9,F$2))
This formula uses MATCH, which returns an integer, inside INDIRECT to be used as a dynamic row reference. This will fail if the participant names are not unique. The SUMIFS inside the SUMPRODUCT allows the row to be treated like an array without using an array formula. So you can recreate the example I have and copy/paste or drag and paste the formulas as you wish.
A different approach may be that you want to sum up the points to the questions first and then do the conversion from question to domain. That way you don't ever have to manipulate the raw data, just the reports. That may be the better approach for you, actually.
Edit: Added information about the formulas and the example.

Substracting two values in same column in Spotfire

I am a beginner in spotfire. I need to make a calculated column from the data shown below
The first column is a list of schools, the second column is the list of ranks students got in an exam and the third is the Score/Mark the particular student got. I need to create a calculated column such that corresponding to every 4 th rank rank of each school I need to see the difference in Score obtained by Rank1 and Rank4 in the same school. I am attaching the desired result below
I think the slution is to use some variant of OVER , but I am not able to figure it out
This will get you what you are looking for
If(([Rank]=1) or ([Rank]=4),[Mark] - Max([Mark]) OVER (Intersect([School],Previous([Rank]))))
#user7266220 - The below expression should get you the desired result.
(If([Rank]=4,[Mark])) - Sum([Mark]) over (Intersect(firstnode([Rank]),[School]))
This works irrespective of rank order.

Resources