Index match function - excel

I have two columns in my spreadsheet, Column A and B both of same size. I have to call out a value from column B which will correspond(same index) to the highest value from column A.
I am using Index-Match which works perfectly for only one highest value from column A. But I want to add another level of sorting for the case of two same highest values in column A.
Suppose, I have two maximums in column A which should give me two corresponding values from table B, from which I want to call out the lowest one.
Can someone help me with this?
Thanks in advance.

If your data are in rows 1-10 of columns A & B with headers, you can use the following:-
=MIN(IF(A2:A10=MAX(A2:A10),B2:B10))
So the inner IF statement produces an array with the values of column B corresponding to the values in column A which are equal to the maximum value in column A, otherwise FALSE. MIN returns the lowest of these, ignoring the FALSE values.
This is an array formula and must be entered with CtrlShiftEnter
If it's possible to have blanks in column B, then you could ignore them with the following:-
=MIN(IF((A2:A10=MAX(A2:A10))*(B2:B10<>""),B2:B10))
otherwise the first formula will read them as zeroes.

Related

I am checking to see if any values in column C match with values from column B

I need preferably a formula or macro in excel 2013 to do the following:
Check if any given values in column C match with values from column B.
If they do I want to take the corresponding value from the same row in column A as the matched items in column B.
I then want to take those values from column A and put them in the same rows in column D.
Specifically, I am checking to see if any ID's in column C match with ID's from column B. If they do I want to take the corresponding city ID from column A in the same row as the matched items in column B.
I then want to take those values from column A and put them in the same rows in column D.
I used this formula =VLOOKUP(C6; A2:B14; 1; FALSE) but it returns #N/A
VLOOKUP will always use the first column as lookup_array. But in your case, you are using the second column for lookup_array, and wanting to return the value in the first column. So VLOOKUP is not appropriate.
Depending on your version of Excel, you could use INDEX(MATCH or XLOOKUP:
=INDEX($A$2:$A$14,MATCH(C2,$B$2:$B$14,0))
=XLOOKUP(C2,$B$2:$B$14,$A$2:$A$14)

Column B's numerical values must be greater than Column A, given that Column A could have negative values, Data Validation in Excel

I have two Columns A and B, when I key in a value in A1, and then proceed to key in a value in Column B, I want Column B to do a validation check on the input in Column B, making sure that the value in Column B is greater than the value in Column A, in numerical sense, but not in absolute values.
Often times, values in Column A are negative values, so I would like to find a custom formula which will take into account the negative signs.
For Example: when Column A has 100, Column B should be 102. When Column A has -100, Column B should have -102. Appreciate your help!!
Try data validation like below screenshot.

Remove duplicates in excel based on another column value

My excel values are like (Column A and B):
Now, I want to remove duplicates in column A if any duplicates has value of zero (in column B). So for the above example, I should keep a and b only.
I tried:
IF((COUNTIF(A:A,A2)>1)*(B2=0),"REMOVE","KEEP")
and I get:
But for all c's, it should be remove.
What's wrong in my if condition?
Thanks.
Check if any row with the same value in column A contains a zero:
=IF(COUNTIFS(A:A,A1,B:B,0),"Remove","Keep")

Can i use SUMPRODUCT to ignore blank cells?

My spreadsheet has a list of names (some are repeated) in column A, a list of numbers stored in a string in column B, and column C uses a formula to get the first number of the string in column B. In column E have created a list of the unique names from column A, in column F a number of times they appear in the data list and in column G i then want to fetch the corresponding number data from column C each time it appears in the list to calculate average numbers.
I have tried this
=SUMPRODUCT(($A$1:INDEX($A:$A,COUNTA($A:$A))=$E4)*($C$2:INDEX($C:$C,COUNTA($C:$C))))/$F4
The problem i have is that in the list of data some of the cells in column C are blank so i am getting a #VALUE error.
Here is a screenshot of what i am trying:
Is there anyway to tell SUMPRODUCT to skip the rows where there is no number data?
Obviously this is just an example and my actual spreadsheet is a little more complicated, there are thousands of rows of data and the names are repeated many times over.
Empty cells are not your problem. It would just be accepted in a formula like yours. Unfortunately the problem is because you have gaps, COUNTA will return a range that's not equal to column A > COUNTA in column A will return 15, whereas COUNTA in column C will return 11. Unequal ranges will return #VALUE
In this specific case your issue is resolved through:
=SUMPRODUCT(($A$1:INDEX($A:$A,COUNTA($A:$A))=$E4)*($C$1:INDEX($C:$C,COUNTA($A:$A))))/$F4
In G4, copied down :
=SUMIF($A:$A,$E4,$C:$C)/$F4
Edit : SUMIF() can use whole column reference of which bounded on used range only, and can avoid to use dynamic range.

Excel - Comparing multiple columns to see if results are identical

I would like to compare three separate columns in an excel spreadsheet, across thousands of rows.
If any value appears in column A multiple times (say the word hello in column A rows 1 and 4, and the word bye in column A and rows 3 & 5, I would like to check the corresponding values in column B for those rows (ie rows 1&4 and 3&5).
If the values in column B for rows 1&4 are say 15 & 15, and the values for rows 3&5 are 20 & 20 , then I want to check column C.
Now we know rows 1&4 and 3&5 have the same corresponding values in column A & B, I would like to check the corresponding values in column C. If these are different then I would like to perform a specific calculation. If they are the same values in Column C, then I want to ignore these rows.
I am sorry this is very unclear, as I cannot paste an image to show what I mean. I can email you an example if it helps.
This is way beyond me and my excel skills and I do not know where to start. Any help would be appreciated. I am hoping I don't need to write a Macro.
Thanks in advance!
So, to resummarize your question as I understand it:
Column A holds string values (text). There are some duplicates here.
Column B holds number values. When a duplicate occurs in column A, the data in column B may or may not be identical as for the other duplicate entries.
Column C holds values (you did not define what type of values, but I assume these are number values). Sometimes, duplicates in column A hold the same values in column B, and also the same values in column C. In this case, we can ignore the row as all the duplicates agree. Sometimes, duplicates in column A hold different values in column B. In this case, we can also ignore the values. Finally, sometimes duplicates in column A hold the same values in column B, but different values in column C. For these specific values, we want to perform some other type of calculation (which you did not specify).
Put the following in column D, starting at row 2 (assuming a header on row 1), which is the starting point of the formula we will build.
=IFERROR(VLOOKUP(A$1:B1,A2,2,0)=B2,"")
This says: Look at column A, starting always at row 1, and going until 1 row above the current row. Check for a match of the text in the current row. If it finds a match there, pull the result from column B. Does that result match column B in the current row? If it matches it will say TRUE; if it doesnt match it will say FALSE. If there are no duplicates yet in column A it will say "".
Now add a new check - if the above formula is TRUE [ie: there is a duplicate in column A, and the result in column B matches], then we want to check the results from column C:
=IFERROR(IF(VLOOKUP(A$1:B1,A2,2,0)=B2,VLOOKUP(A$1:C1,A2,3,0)=C2,""),"")
This will now return TRUE if the values in column C match for that duplicate in column A (which is only checked if the values in column B match too). Finally, add in your "special calculation", like so:
=IFERROR(IF(VLOOKUP(A$1:B1,A2,2,0)=B2,IF(VLOOKUP(A$1:C1,A2,3,0)=C2,"",C2+1),""),"")
Where I have C2+1, this is where you will perform your special calculation. This will only be recorded by Excel if: there is a duplicate in column A, that duplicate has a matching value in column B, and that duplicate has an unmatched value in column C.

Resources