Excel Ranking tie assistance - excel
Can anyone help me to do the following in relation to ties when using the Excel Rank function?
Col A contains scores and B contains the rank. I am quite happy with this except that I would like to show an '=' next to the ranking where it is a tie:
Score Rank
66 3
64 4=
63 6
68 2
64 4=
81 1
etc
Many thanks.
You can combine your RANK with COUNITF. Place the following into cell B3 as per the example
=RANK(A3,$A$3:$A$7)&IF(COUNTIF($A$3:$A$7,A3)>1,"=","")
Note, if you are using Excel 2013 or 2016, it would be a good idea to replace RANK with RANK.EQ
This can be done in another column next to the column where you have ranked it.
Step 1: Rank the numbers in a simple manner using RANK.EQ
Output:
(A)|(B)
66 | 3
64 | 4
63 | 6
68 | 2
64 | 4
81 | 1
Step 2: In another column use the code IF(COUNTIF(A:A,A1)>1,CONCATENATE(B1,"="), B1)
Output:
(A)|(B)|(C)
66 | 3 | 3
64 | 4 | 4=
63 | 6 | 6
68 | 2 | 2
64 | 4 | 4=
81 | 1 | 1
You can paste the values and remove the columns as required.
Hope it helps. :)
Related
Counting 15's in Cribbage Hand
Background This is a followup question to my previous finding a straight in a cribbage hand question and Counting Pairs in Cribbage Hand Objective Count the number of ways cards can be combined to a total of 15, then score 2 points for each pair. Ace worth 1, and J,Q,K are worth 10. What I have Tried So my first poke at a solution required 26 different formulas. Basically I checked each possible way to combine cards to see if the total was 15. 1 way to add 5 cards, 5 ways to add 4 cards, 10 ways to add 3 cards, and 10 ways to add 2 cards. I thought I had this licked until I realized I was only looking at combinations, I had not considered the fact that I had to cap the value of cards 11, 12, and 13 to 10. I initially tried an array formula something along the lines of: MIN(MOD(B1:F1-1,13)+1,10) But the problem with this is that MIN takes the minimum value of all results not the individual results compared to 10. I then tried it with an IF function, which worked, but involved the use of CSE formula even wehen being used with SUMPRODUCT which is something I try to avoid when I can IF(MOD(B1:F1-1,13)+1<11,MOD(B1:F1-1,13)+1,10) Then I stumble on an answer to a question in code golf which I modified to lead me to this formula, which I kind of like for some strange reason, but its a bit long in repetitive use: --MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2) My current working formulas are: 5 card check =(SUMPRODUCT(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2))=15)*2 4 card checks =(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,3,4}))=15)*2 =(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,3,5}))=15)*2 =(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,4,5}))=15)*2 =(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,3,4,5}))=15)*2 =(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{2,3,4,5}))=15)*2 3 card checks same as 4 card checks using all combinations for 3 cards in the {1,2,3}. There are 10 different combinations, so 10 different formulas. The 2 card check was based on the solution by Tom in Counting Pairs in Cribbage Hand and all two cards are checked with a single formula. (yes it is CSE) 2 card check {=SUM(--(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2)+TRANSPOSE(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2))=15))} Question Can the 3 and 4 card combination sum check be brought into a single formula similar to the 2 card check? Is there a better way to convert cards 11,12,13 to a value of 10? Sample Data | B | C | D | E | F | POINTS +----+----+----+----+----+ | 1 | 2 | 3 | 17 | 31 | <= 2 (all 5 add to 15) | 1 | 2 | 3 | 17 | 32 | <= 2 (Last 4 add to 15) | 11 | 18 | 31 | 44 | 5 | <= 16 ( 4x(J+5), 4X(5+5+5) ) | 6 | 7 | 8 | 9 | 52 | <= 4 (6+9, 7+8) | 1 | 3 | 7 | 8 | 52 | <= 2 (7+8) | 2 | 3 | 7 | 9 | 52 | <= 2 (2+3+K) | 2 | 4 | 6 | 23 | 52 | <= 0 (nothing add to 15) Excel Version Excel 2013
For 5: =(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2 For 4: =SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$5),{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}),ROW($1:$4)^0)=15))*2 For 3 =SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$10),{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}),ROW($1:$3)^0)=15))*2 For 2: SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15)) All together: =(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2+ SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$5),{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}),ROW($1:$4)^0)=15))*2+ SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$10),{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}),ROW($1:$3)^0)=15))*2+ SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15)) For older versions we need to "trick" INDEX into accepting the arrays as Row and Column References: We do that by using N(IF({1},[thearray])) =(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2+ SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,N(IF({1},ROW($1:$5))),N(IF({1},{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}))),ROW($1:$4)^0)=15))*2+ SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,N(IF({1},ROW($1:$10))),N(IF({1},{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}))),ROW($1:$3)^0)=15))*2+ SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15)) This is a CSE That must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Grouping excel files by Week Number
I am trying to work on a Excel that has a giant amount of data with dates, to simplify I want it to group the different numbers into weeks, allow me to explain: The actual rows are like: 29-11-2018 | 49 | 1 | 4 |7 | 2 30-11-2018 | 49 | 4 | 0 |2 | 1 Where "49" is the week number from the date. I'm trying to make Excel put together those lines by week and add the other lines, like this: 49 | 5 | 4 | 9 | 3 And this for all the weeks, so I can know the exact number of data for every week. Is there a way of doing this? Thanks! Regards,
Assuming your data is located at A2:F3.. H2 ---> =B2 put I2 ---> =IF($B1<>$B2,C2,I1+C2) and drag to L2, then N2 ---> =IF($B3<>$B2,H2,"") and drag to R2. Select H2:R2 and drag to the end.. you'll see your intended result in column N to R.
Pivot table calculate field based on grouped values
after years of quietly learning from this site I've finally hit a question who's answer I cannot seem to find on StackOverflow... I have a pivot table that needs to calculate Net Promoter Score from several groups within a population. Net promoter score is calculated like so: [% of Population that give 9 or 10/10] - [% of Population that give 1 to 6/10] Each individual record in my source data can only have a single Score of between 1 and 10: RAW DATA: Date (dd/mm) Country Type Score (1-10) NPS Category 01/05 US Order enq. 9 Promoter 13/05 US Check-out 5 Detractor 28/05 US Order enq. 7 Passive So, with help from the answers below I've added a column to categorise each individual into the Promoter (9 or 10), Passive (7 or 8) and Detractor (1 to 6) groups based on that score: screenshot of raw data (with sensitive items hidden). All that remains now is: How can I create a calculated 'NPS' column like the one shown in my (rudimentary) representation of a pivot table below that takes the Detractor value from the Promoter value? D = Detractor group Pa = Passive group Pr = Promoter group | Order enquiry | Check-out | | D Pa Pr NPS | D Pa Pr NPS | -------------------------------------------------- | GB | | | May | 0 0 100 100 | 30 20 50 20 | Jun | 10 30 60 50 | 35 35 60 25 | Jul | 30 20 50 20 | 40 10 40 0 | US | | | May | 45 15 40 - 5 | 50 10 40 -10 | Jun | 40 30 30 -10 | 40 30 30 -10 | Jul | 5 35 60 55 | 20 40 40 20 | My attempt at a calculated column can be seen in this screenshot. This results in an error and of course I haven't managed to convert the NPS counts into percentages yet.
It would be my suggestion to create a new column in the source that calculates D, Pa,Pr by a formula. You can now create the % for these values in the pivot. The NPS column can either be calculated after pivoting the output field, or by creating a pivot-column formula in Excel.
It's not clear from your question how your data is laid out, or what exactly you're asking. From what I can see, you need to add a column in your raw data table, which says something like =COUNTIFS(UniqueID,MyUniqueID,Score,">=9")-COUNTIFS(UniqueID,MyUniqueID,Score,"<=6") Then another column that says =IF(NetPromoter>=9,"Pr",IF(NetPromoter>=7,"Pa","D")) And then in your pivot table you add the Classification as a new subcolumn, and add the NPS as the Average of your NPS column, or something like that. Please show your data if you want the formulas changed to meet your actual range/variable terms.
Increment a number inside excel formula sidewise
I have following numbers in Column D1 to D21 1 | 4 | 51 | 4 | 57 | 6 | 16 | 11 | 41 | 3 | 26 | 3 | 27 | 5 | 3 | 5 | 8 | 6 | 22 | 6 | 23 I want to write a formula which will produce an output like this: 6:23 6:22 5:8 5:3 3:27 3:26 11:41 6:16 4:47 4:51 1 I have put the following formula on Column P1 and tried dragging on the left side but it is showing the same value in all rows as the value of 1 & 2 is not changing to 3 & 4: This is what i want: OFFSET($D$1,1,0)&":"&OFFSET($D$1,2,0) OFFSET($D$1,3,0)&":"&OFFSET($D$1,4,0) OFFSET($D$1,5,0)&":"&OFFSET($D$1,6,0) The middle value in the above formula should change.
I've tested with a smaller range of values and the following should work for you. You'll need to replace $A$1:$I$1 with your range. =IFERROR(OFFSET($A$1,0,COUNT($A$1:$I$1)-(COLUMN()*2))&":"&OFFSET($A$1,0,COUNT($A$1:$I$1)-((COLUMN()*2)-1)),IF((COUNT($A$1:$I$1)+1)=(COLUMN()*2),$A$1,"")) Also tested with your full range $A$1:$U$1: =IFERROR(OFFSET($A$1,0,COUNT($A$1:$U$1)-(COLUMN()*2))&":"&OFFSET($A$1,0,COUNT($A$1:$U$1)-((COLUMN()*2)-1)),IF((COUNT($A$1:$U$1)+1)=(COLUMN()*2),$A$1,""))
Aligning cells into the same column based on similar values
I recently pulled some data into excel and some of the cells ended up like : {paypal:34, giftcard: 34, authorizenet: 44} (for payment methods) I managed to divide them up into separate columns as such: paypal: 34 | giftcard: 34 | authorizenet: 44 | but not all lines have the same categories. Some have less payment methods while others have more. So I basically have a large table of paypal: 34 | giftcard: 34 | authorizenet: 44 | authorizenet: 34 | giftcard: 34 | authorizenet: 44 | paypal: 34 | check: 3 | Is there a way to align the cells in each row where if they contain "paypay", they align into a single column and so on? I was thinking about sorting but they won't exactly line up. paypal: 34 | giftcard: 04 | authorizenet: 34 | paypal: 31 | giftcard: 24 | authorizenet: 45 | paypal: 74 | giftcard: 31 | authorizenet: 74 | Thanks!
You should start by using the 'Text to Columns' functions in excel. First, select all your data then go to: Date > Data Tools > Text to Columns. Next, select 'Delimited' > Next > Next, check only 'Comma' > Next > Finally, Click 'Finish' Now you have all of the different payment types in separate columns/ cells and need to 'align' all your 'Paypal' in the same column and 'Authorize.Net' in the same column and so on. Use the following formula to get this 'alignment' part done: =IF(LEFT(C7,6)="Paypal",C7,IF(LEFT(D7,6)="Paypal",D7,IF(LEFT(E7,6)="Paypal",E7,""))) =IF(LEFT(C7,6)="Giftca",C7,IF(LEFT(D7,6)="Giftca",D7,IF(LEFT(E7,6)="Giftca",E7,""))) =IF(LEFT(C7,6)="Author",C7,IF(LEFT(D7,6)="Author",D7,IF(LEFT(E7,6)="Author",E7,""))) You will need to edit the directly reference cells that I show above to fit your own worksheet needs. My parsed (after splitting my data from delimiters) data was in columns C, D, and E. Therefore, I used C7, D7, and E7 to use the 'left' formula on. These formulas on my worksheet were in cells G7, H7, and I7. Give is a try and let me know. Tip: on the 'Left' formula, make sure the text string is exact (capitals, spaces, etc). Good luck!