I'm trying to rank on multiple criteria values and window but do not want ties within ranks.
The formula i have satisfies the multiple criteria but not tie breaking.
=COUNTIF($H$5:$H$105412<"&H89)+COUNTIFS($H$5:$H$105412,H89,$E$5:$E$105412,"<"&E89)+1
I'd like for the highlighted values to be unique and break ties.
Thanks for your help!
this worked for me. it ranks the value against the range while considering the condition of windows as a criteria and also break ties when a duplicate occurs within the same condition or window
=RANK(E5,INDEX(E$5:E$1000,MATCH($H5,$H$5:$H$1000,0)):INDEX(E$5:E$1000,MATCH($H5,$H$5:$H$1000,0)+COUNTIF($H$5:$H$1000,$H5)-1),1)+COUNTIFS($H$5:$H5,$H5,$E$5:$E5,$E5)-1
Add one more column beside it, say column J and write this formula in Cell
J6=COUNTIFS($H$5:$H6,$H6,$E$5:$E6,$E6,$I$5:$I6,$I6)
Now drag this formula down till the end of your sheet.
This will record the instances in which the combination of ranks occur in ascending order.
Just filter out all values where the value in column J is 1. This will be the single non-duplicate entry.
Related
So I have this spreadsheet
I am trying to workout the most picked item out of each bin based on the style and colour, I have created a sumif formula that counts and adds all of the items that is the same colour. I am now trying to create a ranking for each item based upon the Style Color Pick QTY and the month.
=(COUNTIFS(A:A,[#[bin-name]],I:I,[#Month],K:K,">"&[#[Style Color Pick QTY]])+1)
The problem is that it ranks every individual line, so instead of PS-1 Scarlet having a rank of 7 I would like it to have a rank of 2.
I have tried adding extra conditions to this such as an extra sumif that checks the previous result, or putting them in IF statements to compare to other results but all of my attempts result all Ranks being 1 or not changing.
So I am looking to modify this formula or being able to write a =unique() formula in another sheet and run the Rank Countif formula against that, I am able to write this but not sure how how to embed the # to make the formula dynamic(i.e. So i'm not dragging the formula down 1000 lines).
Any help would be appreciated.
I found an unelegant solution to your problem. This approach might be able to be refactored into a more elegant solution though.
Column Rank is the column you already have.
Column Uniques is a helper column that has the formula =IFERROR(INDEX([Rank]; MATCH(0; INDEX(COUNTIF($B$1:B1;[Rank]); 0; 0); 0)); "") in its first cell B2.
Getting the Proper_Rank is now as easy as =RANK([#Rank];[Uniques];1).
The two helper columns Rank and Uniques can of course be hidden or placed wherever you want. As I said, it's probably possible to combine these helper columns into one calculation, but I don't know how.
So, I've searched for an answer to this, but I can't find anything. Hopefully some Excel guru out there has an easy answer.
CONTEXT
I have a sheet that has two columns; a list of airport codes (Col A) and a list of fuel gallons (Col B). Column A has a bunch of duplicate entries, column B is always different. It's basically a giant list of fill-up events for aircraft over time at different airports. The airports can be the same, because it's one row per fill-up event.
PROBLEM
What I want to do is have a formula that takes the enter data set, finds all identical entries in Col A, sums the Col B values for the matches, and spits out the result on a separate sheet with one entry for every set/match.
OTHER STUFF
I do not have a reference list for Column A and I would rather not create one since there are thousands of entries. I would like to just write a formula that does all this at once, using the data itself as the reference.
All the answers I find are "create a reference list on a separate sheet", and it's driving me crazy!
Thanks in advance for any help!
-rt
Sounds that you need a formula version of remove duplicated for column A, and a simple sumif for column B.
Column A
=IFERROR(INDEX(Data!A$1:A$1000,SMALL(IF(
MATCH(Data!A$1:A$1000,Data!A$1:A$1000,0)=ROW(Data!A$1:A$1000),ROW(Data!A$1:A$1000)),ROW())),"")
Array Formula so please press Ctrl + Shift + Enter to complete it. After that you might see a {} outside the formula.
Column B
=SUMIF(Data!A$1:A$1000,A2,Data!B$1:B$1000)
Just change the range for your data.
Reminders: The formula in columnA should starts from Row#1, or you have to add some offset constant for adjustments.
Since the returning value of MATCH() represents the position of the key in the given array. If we wanted it to be equal to its row number, we have to add some constant if the array is not started from ROW#1. So the adjustment of data in Range(B3:B1000) is below.
=IFERROR(INDEX('Event Data'!B$3:B$1000,SMALL(IF(
MATCH('Event Data'!B$3:B$1000,
'Event Data'!B$3:B$1000,0)+2=ROW('Event Data'!B$3:B$1000),
ROW('Event Data'!B$3:B$1000)),ROW())-2),"")
Further more, the range should exactly the same as the data range. If you need it larger than the data range for future expandability, an IFERROR() should added into the formula.
=IFERROR(INDEX('Event Data'!B$3:B$1000,SMALL(IFERROR(IF(MATCH(
'Event Data'!B$3:B$1000,'Event Data'!B$3:B$1000,0)+2
=ROW('Event Data'!B$3:B$1000),
ROW('Event Data'!B$3:B$1000)),FALSE),ROW())-2),"")
Lastly, I truly recommended that you should use the Remove Duplicated built in excel since the array formula is about O(n^2) of time complexity and memory usage also. And every time you entered any data in even other cells, it will automatically re-calculate all formulas once the calculation option in your excel is automatic. This will pull down the performance.
I am using CountIf to find the number of duplicate values in a column. First I sorted the values in ascending order. Then I apply =COUNTIF(B:B;B2) and dragged it till end. The Results are as:
However, I don't want the values multiple times in the column C. Just need it for one time. Also is it possible without sorting the column B in ascending order?
Try this,
=if(countif(b$2:b2, b2)=1, countif(b:b, b2), text(,))
Fill down. The data does not require sorting.
One table has policy numbers and the agent who wrote each policy. An agent's name multiple times.
Another table has just the policy numbers and I want to add the agents' names next to the numbers.
VLOOKUP doesn't work because the firs table shows the agents' names multiple times.
Any ideas how to do this?
If the numbers are unique and only the Agents are duplicates, you can use Index/Match or Vlookup.
With Index / Match:
=IFERROR(INDEX(Policy!$B$2:$B$15,MATCH(A2,Policy!$A$2:$A$15,0)),"")
Policy is the sheet where you have Numbers (Column A, A2:A5)and corresponding Agent (Column B, B2:B15) change the references to correspond the last row but keep $ for fixed references. You can drag it down next to A2 where the numbers that you need to find their Agent are.
With Vlookup:
=IFERROR(VLOOKUP(A2,Policy!$A$2:$B$15,2,FALSE),"")
You can drag it down, next to A2 where the numbers are in the new sheet.
Also change Policy!$A$2:$B$15 to correspond the references of your Data.
2 to return the value from the second column (Agent)
False for exact match.
I am working on a project within an excel database and am trying to match 4 different properties which all have their own columns (A,B,C,D) to find a corresponding value on a different page (Sheet2!). One sheet 2 the values are once again found in their own columns (B,C,D,E) and if all of the values match I then want the value in column A Sheet2! to be displayed in column E on sheet1!
The problem is is that often times the values on Sheet1! will be able to match up with as many as 12 different unique rows on Sheet2! making this incredibly difficult with only intermediate experience in VBA. There can be duplicates that match all of the criteria. And for when this happens I would like to return the first item that matches, as long as a previous match was not made on that item.
To give you more information we have given products different values that designate where they belong based off their velocity. This has split them up into Section#, ShelvingType, Verticle, and Horizontal Location. And we are looking to match these values to the values of our previously existing locations that we have that have corresponding(matching) numbers or text values.
To go into even more detail, on sheet one we have the products with values on where they should go. One sheet two with have pre-existing locations for which products can go that have values that are represntative of that location. So, we want to take the products NEW location values off page one and match the existing location values on page two. The problem is that for every location there are up to 12products that could go there. So, we want to go in order saying that product1 goes in the first location with matched values while product2 goes in the next location with matched values, and so on and so fourth
Edited to remove previous responses
Based on your further elaboration, if I understand correctly, I agree with the comment left by #Aaron Contreras. You should create helper columns which show a 'unique ID' where all criteria match, as well as an additional helper column which increases as more items of the same criteria code are found. This will become the 'ultra-unique' ID for that item.
At this point I don't think array formulas will be possible, though I will leave in the answer which provides the result of the first matching criteria without further eliminating 'previously used' results. This could likely be further refined, but I doubt it would be more elegant than simply using the helper columns shown in my response below. At least, I can't figure out how to do it elegantly.
To summarize my assumptions:
-Your available space is in sheet1; column A contaions something like the location of that available space, and columns B-E contain criteria for anything which will be stored there.
-Your new list of items to be placed in a location is in sheet2; columnA will be where our formula goes, showing the available location to put that item.
Enter on Sheet1
In column F on sheet1, drag down this formula:
=B1&C1&D1&E1
This will create a unique ID key to be searched in the future.
However, as there will be multiple hits for the same criteria on sheet1 (because multiple locations can hold the same thing), we need to make each row 'more unique' by showing how many times that criteria combination has already occurred. This formula will thus go in column G on sheet1, starting in cell G1 and dragged down:
=F1&countif($F$1:F1,F1)
As you drag it down, this will count the nth time that the specific combination of criteria has appeared on sheet1.
Enter on Sheet2
Create the same columns in sheet2, in columns F & G. The formulas will be exactly the same, they will just refer to sheet2 instead of sheet1.
Then the formula in column A in sheet 2, dragged down from A1, would be:
=index(sheet1!A:A,match(G1,sheet1!G:G,0))
This will find the first time that all criteria match from sheet1, for the nth time that this criteria has been used on sheet 2.
Let me know if there is anything here I've missed.
Unfinished array method
Again, array responses are possible, but for your purposes likely unnecesarry; you should probably have a unique ID for all combinations anyway. However, in case you want to use the array method, you can like so (does not account for multiple locations being used; left for reference only if you want to take this up):
In sheet2, enter the following formula [confirmed with CTRL + SHIFT + ENTER instead of just ENTER, every time the formula is changed] on the row 1, with the different criteria (and copied down):
=index(Sheet1!A1:A100,match(1,(Sheet1!B1:B100=B1)(Sheet1!C1:C100=C1)(Sheet1!D1:D100=D1)*(Sheet1!E1:E100=E1),0))
This uses the inherent boolean logic of "TRUExTRUE = TRUE; TRUExFALSE = FALSE; FALSExFALSE = FALSE", to find the first row where there is a match of all criteria. Note that I have not made this go all the way down all columns, as with Array formulas this is a significant resource hog.
Assuming that your data starts from 2nd row (1st row for lables):
{MATCH(A1&B1&C1&D1,B2:B100&C2:C100&D2:D100&E2:E100,0)}
The above is an array formula, so you don't have to input the curly brackets {.
Simply press Ctrl + Shift + Enter after typing the formula
More info