If X then look for Y in same row (Excel) - excel

Sample spreadsheet
Looking to find out how many times each name appears in right 4 columns depending on the W/L column. Example output I am looking for is a count of times Mozzie appears in any of the four right side columns where there is a W in the W/L Column

Use below formula. Adjust ranges for you sheet.
=SUMPRODUCT((B3:B16="W")*(E3:F16="Mozzie"))

Related

Excel: Count the symbol for each merged cells with different size

I have a table as per below. I want to count column C "Count game win" using a formula. each person plays a different round of game within 24 hours and if he/she wins, it is label as Y. I would like to count Y using a formula but column A in merged cells contains different rows. My formula is column C is
=IF(A2="","",COUNTIF(B2:B3,"Y"))
However, when I drag down or copied to other cells, the data is wrong due to uneven size in merged cells in column A. I have a long list and will be unable to count manually. please advice

Distinct count of values in a column if two other cells match

Struggling a bit with array formula's to count distinct values in one column, in the rows where two other cells match. Sorry if I can't explain any better. Best is to show you the formula I created and provide some sample data:
Sheet 1
Column A Column B
Period 101 Code X
Period 309 Code Y
Period 101 Code Y
Period 101 Code Z
Period 404 Code Y
Period 101 Code X
Period 101 Code X
Period 404 Code X
Period 404 Code Z
Sheet 2
Column A Column B (where the formula should be)
Code X 2
Code Y 3
Code Z 2
Basically I want to count the distinct values in Sheet 1 column A, only where the value in Sheet 1 column B matches the value in sheet 2 column A. I have provided the expected outcome for the three code values.
I have tried with the following formula, but I am unable to count distinct values in another column where the two cells match:
{=SUM(--(FREQUENCY(IF(C5:C11=G5,MATCH(B5:B11,B5:B11,0)),ROW(B5:B11)-ROW(B5)+1)>0))}
Please ignore the rows and columns used in the formula, also the values in Column A and B on sheet 1 both occur multiple times, but the values in column one on sheet 2 only occur once.
I am curious how someone would solve this one. Thank you in advance.
Caveat: This answer is unlikely to be useful to the OP, as these techniques are as yet only available to Excel Insiders
But once these new features are available to the main stream they will be a game changer.
This uses the new Dynamic Array feature coming to Excel soon.
To create the list of unique values from Column B, place this formula in a single cell. Excel will "Spill" into as many rows as needed to return the unique list of values from Column B. For example, I have used cell E2
=UNIQUE(FILTER($B:$B,$B:$B<>""))
Now, place this formula in a the next adjacent cell, I've used F2
=COUNTA(UNIQUE(FILTER($A:$A,$B:$B=$E$2)))
Again, you only need to put this formula in one cell, no need to copy down. Excel will "Spill" the result into as many cells as needed, to match column E.
Your formula doesn't match your sample data but let's assume the below:
Formula in H5:
=SUM(--(FREQUENCY(IF(C$5:C$13=G5,MATCH(B$5:B$13,B$5:B$13,0)),ROW(B$5:B$13)-ROW(B$5)+1)>0))
Entered as array through CtrlShiftEnter and drag down
Notice the semi-absolute cell references (you used relative ones) + how my ranges are larger than yours (you looked from C5:C11 only)

Excel: How to sumif, if the data points share the same row?

How can I look up the column header and output the sum of values underneath the two columns but only if they share the same row. For example in my picture I want to sum under A and C which should output 2 since they share a 1 in both the top row and the bottom row. Again if I wanted the same formula for A and B it would output 0 as they share none of the same data points in the same row. Basically I want to pivot not numerical data and be able to determine the total number of shared x values between my choice of y values.
Use SUMRPODUCT to count where the ranges returned by INDEX/MATCH are equal:
=SUMPRODUCT((INDEX($A$2:$D$6,0,MATCH($F$2,$A$1:$D$1,0))<> "") *(INDEX($A$2:$D$6,0,MATCH($F$2,$A$1:$D$1,0))=INDEX($A$2:$D$6,0,MATCH($F$3,$A$1:$D$1,0))))

Excel formula calculation 70

I am trying to come up with a formula that possibly uses the sumproduct function combined with another function.
Let me start by explaining what I have and what I want. If I have a list of 3 product numbers or more in a column, I would like excel to find the product numbers in 2 different possible columns and if they are listed there, I would like excel to multiply and sum.
I am currently using this formula:
=SUM(SUMPRODUCT(($B$27:$B$46='Lists for Estimates'!K2)*($E$27:$E$46*$A$27:$A$46))
+SUM(SUMPRODUCT(($F$27:$F$46='Lists for Estimates'!K2)*($I$27:$I$46*$A$27:$A$46)))
+SUM(SUMPRODUCT(($B$27:$B$46='Lists for Estimates'!K3)*($E$27:$E$46*$A$27:$A$46))
+SUM(SUMPRODUCT(($F$27:$F$46='Lists for Estimates'!K3)*($I$27:$I$46*$A$27:$A$46)))))
The issue with this is I have to continue to add to the formula if I add more to "Lists for Estimates." I would like to change the formula from 'List for Estimates'!K3 and K2 to search the entire column.
Thank you in advance!
Create a new column on your data sheet that multiplies the A and E columns together (so the formula doesn't have to do it), and then use this formula:
=SUMPRODUCT(SUMIF($B$27:$B$46,'Lists for Estimates'!$K$2:$K$3,$F$27:$F$46))
Where column F contains the multiplied values. Adjust column F to suit your actual data. The multiplied value column can be hidden if preferred, or even put on a different worksheet.

How to get the highest values from 2 columns in Excel?

I have a design software which extracts data in to an Excel sheet format
The output is divided into 2 columns, each of these columns has more than 1000 rows.
To make use of this data I need to summarize it to a maximum of the 5 highest values from both of the 2 columns. Therefore, this doesn't mean that it's the maximum of one column and its corresponding value, but it may mean that the 2nd largest value of column 1 & the 4th largest value of column 2.
For example ( if we quoted some of the output data):
The values i should pick here are:
If there is any possible way to achieve that, it will be great
Thanks ..
example file: http://goo.gl/UIEFEv
example file 2: http://goo.gl/VSvuVf
Here's a formula solution. I used 20 rows and extracted the rows which contain the top 5 for each column - you can extend to as many rows as required.
With data in A1:B20 use this formula in D1 confirmed with CTRL+SHIFT+ENTER and copied across to E1 and down both columns:
=IFERROR(INDEX(A$1:A$20,SMALL(IF(($A$1:$A$20>=LARGE($A$1:$A$20,5))+($B$1:$B$20>=LARGE($B$1:$B$20,5)),ROW(A$1:A$20)-ROW(A$1)+1),ROWS(D$1:D1))),"")
Note: there are only eight rows extracted because some of the rows contain values in the top 5 for both columns. I added the highlighting in colums A and B to more clearly illustrate
see screenshot below
Edit:
From the comments below it seems that you want a combination of rows which contain the highest value for that column....and rows which contain the highest total for both columns.
In the original formula there are two conditions joined with "+", i.e.
($A$1:$A$20>=LARGE($A$1:$A$20,5))+($B$1:$B$20>=LARGE($B$1:$B$20,5)
The "+" gives you an "OR" type functionality, e.g. in this case rows are included if individual values are in the top 5 in that particular column. You can add other conditions, so if you want to also add any rows which are in the top 5 considering the total of both columns then you can add another "clause", i.e.
($A$1:$A$20>=LARGE($A$1:$A$20,5))+($B$1:$B$20>=LARGE($B$1:$B$20,5)+($A$1:$A$20+$B$1:$B$20>=LARGE($A$1:$A$20+$B$1:$B$20,5))
....and including that in the complete formula you get this version:
=IFERROR(INDEX(A$1:A$20,SMALL(IF(($A$1:$A$20>=LARGE($A$1:$A$20,5))+($B$1:$B$20>=LARGE($B$1:$B$20,5))+($A$1:$A$20+$B$1:$B$20>=LARGE($A$1:$A$20+$B$1:$B$20,5)),ROW(A$1:A$20)-ROW(A$1)+1),ROWS(D$1:D1))),"")
You could refine that further by using combinations of + and * (for AND), e.g. for the new condition you might only want to include rows with a total in the top 5 if one of the single values is in the top 10 for that column...
Explanation:
The above part shows how you can use + for the OR conditions. In the formula if those conditions are TRUE then the IF function returns the "relative row number" of the range (using ROW(A$1:A$20)-ROW(A$1)+1).
SMALL function then extracts the kth smallest value, k being defined by ROWS(D$1:D1) which starts at 1 in D1 (or E1) and increments by 1 each row.
INDEX function then takes the actual value from that row.
When you run out of qualifying rows SMALL function will return a #NUM! error which IFERROR here converts to a blank
The question is a little unclear but if what you mean is to get the 5 highest values of Column A and their corresponding values in Column B then the five highest values in Column B and the corresponding values in Column A then the (non automated) solution is pretty simple.
Click on a cell with a header title in it.
Click on 'Data' in the top menu.
Click on 'Filter' in the 'Sort & Filter' section.
Click on the button on Column A - select 'Sort Largest to Smallest'
Grab the top five values from both columns then click on the button in column B and repeat.

Resources