Use a formula by Group in excel - excel

I want to count how many games have past for a particular team to have as a game result a tie. I made a search and i found that for this reason i could use the Match() function, which i did and it worked. The problem is that i want to calculate this by team, and not by whole, as you will see at my linked file. I considered use Pivot table or subtotals but i didn't manage to find a workaround. Does anyone have something to suggest?
You can see the data here: https://drive.google.com/file/d/0B3_Yf9GS73seQ3FRdVhWX21LQ3c/view?usp=sharing
It's an xlsx file
Thank you in advance

Here is a solution, it should cover everything:
J2 formula:
=IF(E2="Tie",COUNTIFS($A$2:A2,A2)-1,0)
K2 formula:
=IF(J2=0,0,ROW(J2))
L2 formula:
=IF(AND(E2="Tie",E1="Tie"),0,IF(J2=0,1,IF(MAX($K1:K$2)>0,SUM(INDIRECT("L"&ROW(L1)&":L"&MAX($K1:K$2)+1)),COUNTIF($A$2:A2,A2)-1)))
It is artificial lookup, couldn't think of anything better.
Note: Sort by club name first to get accurate results!

Related

lookup with multiple conditions and for rows

Hello sages from StackOverflow,
I'm in search of a formula that can relate 3 diferent conditions, I tried using some IF statemets with the TEXTJOIN formula but I find myself lost in the way,
I got a data base just like this (image below), just a much bigger one, I want to search for a key like MCAA01 and obtain the doc's that have in front of it a "NO" all in one cell, like if you use the formula TEXTJOIN("/",...
My problem is that I cannot find a way to relate the whole column of the doc's with the key,
I tried something like TEXTJOIN("/",TRUE,IF(2ndIMAGE!A2=1stIMAGE!B1,IF(B2="no",1stIMAGE!A2,""),""))
This does give a result but it's just 1 thing, not whole answer
please sages of StackOverflow, you're my only hope. Thank you!
You need FILTER() then TEXTJOIN().
=TEXTJOIN("/",TRUE,FILTER($A$2:$A$4,FILTER($B$2:$H$4,$B$1:$H$1=$B8)="No",""))
If your version of excel supports LAMBDA() function then you can try below formula and you do not need to drag the formula to each cell. It will spill results automatically.
=BYROW(B8:B14,LAMBDA(a,TEXTJOIN("/",TRUE,FILTER(A2:A4,FILTER(B2:H4,B1:H1=a)="No",""))))

Sumifs or index match?

Thank you for helping me out. I am working on a way to add up how many pieces each department is handling per week...My data are organized as below. Each row represents an order. There is an order qty. And the orange grid has the week numbers during which the department is handling that order.
Data layout
I am trying to summarize by week how many pieces each department is handling..and While I have a series of sumif statements to work around, I am wondering if the brain trust has a more elegant solution...Thanks again.
desired output
MMULT() with SUMPRODUCT() may give you expected result.
=SUMPRODUCT(MMULT(($C$2:$G$4=$A8)*($C$1:$G$1=B$7),TRANSPOSE({1,1,1,1,1}))*($B$2:$B$4))
You may need to enter the formula as array entry means confirm with CTRL+SHIFT+ENTER. If you have Excel O365 then you can use dynamic formula SEQUENCE() which will give you best performance for large numbers of columns. Try-
=SUMPRODUCT(MMULT(($C$2:$G$4=$A8)*($C$1:$G$1=B$7),SEQUENCE(COLUMNS($C$1:$G$1),,,0))*($B$2:$B$4))

How To Use Formula In Order To Find The Recommended Company In Excel

I need to know whether these is a formula to find the selected company using excel.
For Example, I use the Min formula to find the lowest value between 3 selected company. But what I want is to auto select the company name with the lowest value.
Eg.
Any help is really much appreciated.
With Excel365 you can use XLOOKUP() in this way.
=XLOOKUP(MIN(A2:C2),A2:C2,A1:C1)
You can also use INDEX/MATCH as #BigBen suggested.
=INDEX(A1:C1,,MATCH(MIN(A2:C2),A2:C2,0))

Ranking formula in excel based on two columns

I'm trying to rank the following items based on price using the following formula =SUMPRODUCT(([Item]=[#Item])*([#Price]<[Price]))+1, but it isn't returning any results:
When I use the same formula in the following test table it works, =SUMPRODUCT(($A$2:$A$7=A2)*(B2<$B$2:$B$7))+1:
Can someone please let me know what I am doing wrong? Thanks
EDIT 2 : Evaluation https://imgur.com/a/eXIYPAP
Your formula works fine for me.
Are you sure that A2 and A3 are the same value? There may be some hidden white space causing problems. Just try
=A2=A3
in another cell to make sure they are the same.
USE COUNTIFS INSTEAD
I don't know why your formula isn't working, however, I would suggest avoiding SUMPRODUCT where you can.
=COUNTIFS([Item],[#Item],[Price],">"&[#Price])+1
This will count the number of prices higher than the current one for each item (+1, if you want the rank to start at 1 instead of 0)
If your goal is to get the ranking for each unique item, =SUMPRODUCT(([Item]=[#Item])*([Price]>[#Price]))+1 should do the trick. If the goal is to get the ranking based only on price, don't have it figured out yet.

Match and lookup to find price

I would be grateful if someone could help with the following.
I have a workbook (called passenger car comparison) that has a column of postcodes (B1) and then columns for different prices (C1:I1).
In a separate workbook (called Search Tool), I would like to display the post codes from B1 as a dropdown list, with the same row also displaying the prices from C1:I1 for that particular post code.
Would I need to use INDEX and MATCH or HLOOKUP? Confused!
There is a link to the spreadsheet here if my explanation isn't clear!
Many thanks in advance!
You can actually use both.
However, you should use VLOOKUP instead of HLOOKUP, because your data elements are in rows, not columns. This is the most direct approach (=VLOOKUP(DropDown,WholeTableFromBtoI,Line,FALSE) - the FALSE here avoids linear interpolation with your postcodes). You can get your line from the row 1 of both cells, using MATCH, if you want to get fancy, by =MATCH(Category,FirstLineOfTable,0).
And, If you intend to use MATCH straightforwardly, your better approach would be using OFFSET as well, as in =OFFSET(FirstCellOfTable,MATCH(PostCode,PostCodeRow,0),MATCH(Category,FirstLineOfTable,0). It's a probably not the most intuitive approach, but it works as well.
Hope that helps.

Resources