Excel comparing 3 columns against golden results/ - excel

I have been trying with little success to compare four columns containing url results to a golden list in excel.
I want to count all the matches in each column and give a running total per set. I have used VLOOKUP, Match and highlight duplicates none seem to be able to give the desired effect
Golden list Column A Column B Column C Column D
I want it to compare the values in the golden list against the other 4 columns and give a score count of all exact matches found. I have read several of the Excel Stack Overflow questions and used youtube with no luck so far.

Computing score for each item in golden list is as easy as:
=COUNTIF(range_of_all_columns, item_from_golden_list)
To get the score for each column you can either:
match each item in each column individually or
match each item in golden list against all of the columns respectively (if exact matches are sufficient)
For the second approach, you can use =IF(ISNUMBER(MATCH(...)), 1, 0) approach - if you have duplicated links in columns, or a simpler formula if they are unique:
=COUNTIF(range_of_1_column, item_from_golden_list)
..and then sum it all up for each column, as illustrated by following picture:

Related

Excel: Finding max value based on two criteria, if max value has two identical results

If we have a table of sports teams, that have all played against each other and two teams are on top equal with x points, the winner would be crowned with the highest average goal differential.
But how would you do that with a formula in Excel?
This is the formula I am using to find the team with the highest points total:
=INDEX($C$8:$C$11,MATCH(MAX($K$8:$K$11),$K$8:$K$11,0))
This formula would give me the result of Ecuador being highest (first result of max value).
But in reality Qatar should be on top based on same points total AND average goal difference being higher.
Any solutions?
I assume you want to sort in descending order first by column P, then by column GD. If that is not the case, you can adjust it accordingly. In cell A8 you can put the following formula:
=TAKE(SORT(A3:I6, {9,8}, -1),2,1)
Here is the output:
You can also select the columns of your interest first via CHOOSECOLS then SORT:
=TAKE(SORT(CHOOSECOLS(A3:I6,1,8,9), {3,2}, -1),2,1)
If you want to include the row title, then:
=HSTACK({"First Place";"Second Place"},TAKE(SORT(A3:I6, {9,8}, -1),2,1))
Note: MATCH/XMATCH is not appropriate in this context, because what you really need is to sort the result, not finding values that match certain conditions. You can do it, but at the end you will end up implementing a sort manually and Excel has a built-in function for that. The resulting formula will unnecessary more verbose.
With SORT function you can use more than one criteria indicating in an array the columns to consider as first and second criteria, etc.. For your example it would be: {9,8} indicating as first sorting criteria column 9 and then column 8, so if column P have the same value, then it sorts by GD. The third input argument is to specify ascending (1, default)/descending order(-1). If you want to have a different sorting criteria for each column, then instead of -1, you can use it {-1,1} which means sort in descending order the column 9 and in ascending order the column 8. For your case you can use also: {-1,-1}, but using -1 produce the same result.

Excel, Match lookup array to ignore hidden rows

NOTE: I'm using Excel 2016, don't have access to the good stuff in 365 :(
I'm trying to build a summary sheet at the moment. The idea is to filter a table, then have the summary formulas pick out the top 5 values in a given column.
To do this I'm trying to use the Large function in Aggregate which will help me ignore hidden rows while also allowing me to extract the nth largest value.
From there I had thought to use match to find the row number of that value within the column so that I could also get text based values from the same row by assigning a column letter via Indirect.
^This is the crux of what I'm trying to do^
The code looks like this at the moment... (Sales is column "R")
=MATCH(AGGREGATE(14,5,Table1[Sales],1),Table1[Sales],0)+62
Would then go be
=INDIRECT("N"&MATCH(AGGREGATE(14,5,Table1[Sales],1),Table1[Sales],0)+62)
Aggregate(14 = Large*
Aggregate(,5 = Ignore hidden rows*
The 62 there at the end is there as the data in the table starts on row 63 (making it more robust with row() is on my list but not there yet).
The issue I'm having is it seems the lookup array in the Match function Table1[Sales] isn't being filtered as the table is being filtered.
At least that's what the results I'm seeing are indicating to me as the row number I'm getting back isn't within the filtered table (I.e. Match is returning a hidden row number).
My question is if anyone has an idea about how make this so that only visible rows are considered within the array.
(If I've completely missed the mark with this and someone has a better idea about how to accomplish this goal (without having to resort to array functions) I'd be very grateful).
Thanks!
Expected results
row
A
B
1
Company A
425
2
Company B
1500
4
Company A
1200
7
Company C
750
15
Company B
100
19
Company A
100
I'd be looking for the nth largest value in column B, say 1200 (second largest) in this example.
=MATCH(AGGREGATE(14,5,B:B,2),B:B,0)
=MATCH((1200),C:C,0))
=3
The expected result is Row 4, but because (again, it seems) the look-up array isn't excluding filtered/hidden rows, it is returning Row 3 instead.
I hope this is a bit clearer!

Appending two lists in excel

I have been trying and searching how to append two lists in excel to use in a formula. The lists do not exist in columns, they are created using a formula. I want to combine the two lists in a single one, not to show the values but to use the new list in a formula. I am using excel 365 (UNIQUE function). Let me replace my initial text by a real small case.
I have an excel file with 3 work sheets. Sheet1 is:
Sheet2 is:
Now I want to run some analysis in Sheet3. In my example I want to count how many unique values from column A have column B containing one of the letters 'a', 'b, 'c', or 'd'. For instance, in Sheet1, the letter 'a' appears in all rows. Column A has 3 unique values. So my result for 'a' is 3. The letter 'b' does not appear for the case where column A is '3'. Therefore the result for 'b' is '2'.
So I create a Sheet3 to show my results. The first column contains a list of letters {a, b, c, d}. I then use the formula:
=COUNT(UNIQUE(FILTER(Sheet1!$A$1:$A$100, ISNUMBER(SEARCH(A1, Sheet1!$B$1:$B$100)))))
From inside out: the SEARCH function looks in cells B1 to B100 (I can live with specifying a larger range) where is the position of the value specified in column A (of the current sheet). If it does, then SEARCH returns a number. I check if the return value is a number (ISNUMBER) and use this to filter values in column A of Sheet1. I then apply the UNIQUE function to these values and finally count them.
Then I do the same with values in Sheet2. And it works. This is the output:
Column B is the number of unique values (as specified above) from Sheet1 and Column C the same from Sheet2.
So far so good. But now I want to have the counting of unique values globally. Not for each Sheet. One cannot just add the values from column B and C, as there might be an overlap. For example, the result for 'a' should be 3, not 5.
The solution here would be to grab the two unique lists (one from Sheet1 and the other from Sheet2), join them, UNIQUE this new list, and count. How do I join them ? That is my question.
Note that this 'counting of unique values' is just an example. I might want to find the maximum, or sort them, or find only prime numbers, or the average, or the median, or something else. So I need a general approach to join the results.
I got options close to a workable thing when all the data is in the same worksheet.
Finally, note that the data size I have is not huge, but it is large (thousands of lines at the most).
Here is something you could try:
=LET(x,{"A","B","C"},y,{"D","E"},z,CHOOSE({1,2},x,y),cnt,MAX(COUNTA(x),COUNTA(y)),seq,SEQUENCE(cnt*2),final,INDEX(z,MOD(seq-1,cnt)+1,CEILING(seq/cnt,1)),FILTER(final,NOT(ISERROR(final))))
Here both 'x' and 'y' variables are placeholders for your two (vertical) arrays. In this case I used: {"A","B","C"} and {"D","E"}. Assuming you just want to place the 2nd array directly under the 1st one, the above suggestion does just that:

How to rank the position of students based on percentange

I hope you are will be fine.
I am stuck in finding the ranks of students based on percentage.
I have Excel table having multiple columns, concerning columns are Percentage and Position. My data set starts from Row 25 = R25(in excel)
I am using following formula to calculate the percentage of the students based on obtained marks and total marks
=IF(V25="F","",N25/O25)
Where Column V includes pass or fail (in case of fail "F"), column N includes obtained marks and column O includes total marks
It produces the correct output as required:
Now comes to the real problem. Finding the rank/position of student.
I am using RANK.EQ formula to calculate the rank/position of the students based on percentage
=IF(V25="F","Nil",RANK.EQ(P25,[Percentage]))
It also produces the correct output as per formula:
complete pic = >
Now what I want
The two student who obtains 80% marks are ranked as 1 (according to data set)
Now the student who obtains 74% marks should be ranked as 2 instead of 3 and so on
Here is the clear picture of what I require:
I already tried the =SUMPRODUCT(), =MATCH(), =COUNTIF() etc.
Got something I hope you can adapt to your needs. I replied your data this way:
As you can see, formula in column B returns ranking as you wish. To get this,I used an array formula:
=IF(A1="";"";SUM(IF(FREQUENCY(IF($A$1:$A$6>A1;$A$1:$A$6);$A$1:$A$6)>0;1))+1)
NOTE: Because this in an array formula, it must be entered into cell pressing CTRL+ENTER+SHIFT or it
won't work! You will know if you did it properly if your formula shows { at start and } at end.
The trick here is you want to rank your data in descendant order, but excluding duplicates. The array formula first gets an array of values higher than criteria (number in row), and then count how many unique values are in that array. If 0, it means is the highest value, so its rank is 1 (that explains the +1 at end of formula). If count returns 1, means there is an unique value higher than criteria. so its rank is 2 (count of 1 + we add 1 = 2), and so on...
Hope you can adapt this to your needs.
For this I used info shown here:
Count unique values among duplicates

Sort Order formula to alphabetise in Excel

I am currently drawing up a spreadsheet that will automatically remove duplicates and alphabetize a list:
I am using the COUNTIF() function in column G to create a sort order and then VLOOKUP() to find the sort in column J.
The problem I am having is that I can't seem to get my SortOrder column to function properly. At the moment it creates an index for two number 1's meaning the cell highlighted in yellow is missed out and the last entry in the sorted list is null:
If anyone can find and rectify this mistake for me I'll be very grateful as it has been driving me insane all day! Many thanks.
I'll provide my usual method for doing an automatic pulling-in of raw data into a sorted, duplicate-removed list:
Assume raw data is in column A. In column B, use this formula to increase the counter each time the row shows a non-duplicate item in column A. Hardcord B2 to be "1", and use this formula in B3 and drag down.
=if(iserror(match(A3,$A$2:A2,0)),B2+1,B2)
This takes advantage of the fact that when we refer to this row counter in our revised list, we will use the match function, which only checks for the first matching number. Then say you want your new list of data on column D (usually I do this for display purposes, so either 'group-out' [hide] columns that form the formulas, or do this on another tab). You can avoid this step, but if you are already using helper columns I usually do each step in a different column - easier to document. In column C, starting in C3 [C2 hardcoded to 1] and drag down, just have a simple counter, which error-checks to the stop at the end of your list:
=if(C2<max(B:B),C2+1," ")
Then in column D, starting at D2 and dragged down:
=iferror(index(A:A,match(C2,B:B,0)),"")
The index function is like half of the vlookup function - it pulls the result out of a given array, when you provide it with a row number. The match function is like the other half of the vlookup function - it provides you with the row number where an item appears in a given array.
Hope this helps you in the future as well.
The actual reason that this is going wrong as implied by Jeeped's comment is that you can't meaningfully compare a string to a number unless you do a conversion because they are stored differently. So COUNTIF counts numbers and text separately.
20212 will give a count of 1 because it is the only (or lowest) number.
CS10Z002 will give a count of 1 because it is the first text string in alphabetical order.
Another approach is to add the count of numbers to the count if the current cell contains text:-
=COUNTIF(INDIRECT("$D$2:$D$"&$F$3),"<="&D2)+ISTEXT(D2)*COUNT(INDIRECT("$D$2:$D$"&$F$3))
It's easier to show the result of three different conversions with some test data:-
(0) No conversion - just use COUNTIF
=COUNTIF(D$2:D$7,"<="&D2)
"999"<"abc"<"def", 999<1000
(1) Count everything as text
=SUMPRODUCT(--(D$2:D$7&""<=D2&""))
"1000"<"999"
(2) Count numbers before text
=COUNTIF(D$2:D$7,"<="&D2)+ISTEXT(D2)*COUNT(D$2:D$7)
999<1000<"999"
(3) Count everything as text but convert numbers with leading zeroes
=SUMPRODUCT(--(TEXT(D$2:D$7,"000000")<=TEXT(D2,"000000")))
"000999" = "000999", "000999"<"001000"

Resources