Compare columns of duplicated numbers and populate a fourth column - excel

I have seen questions on here that are similar but not the exact issue I am having. It is below and please forgive me if I don't explain this well.
I have 3 columns.
Column A is a list of file numbers in our system. This column contains many duplicates and is 172522 rows.
Column B is that same list of file numbers, but with the duplicates removed. This is 28858 rows.
Column C is a list of Reference numbers corresponds with Column B exactly, i.e. C2 is a reference number for B2 and so on
I need a query that pulls the reference number from C and places in it column D, for as many times as the file number occurs in Column A. So I get a list of duplicated filenos with their corresponding duplicated Reference numbers
Is this possible?

=VLOOKUP(A1,$B$1:$C$28858,2, False)
Vlookup takes a value and finds it in a "range" and then allows you to take another value in that range and return it. In this case, the 2nd column of range B,C. Though i believe the first column in the range is always the one it has to look through.

Related

Excel: Trying to return value from separate workbook based on matching ID and greater than less than range

I'm new to excel so bear with me.
This problem involves two separate workbooks. My goal is to populate one column with data from the source workbook based on an exact ID match, as well as being in a range of two numbers. In the workbook to be populated, column H is where the data will be populated. Column B holds the ID value, and column D has a number value that is to be in the middle of the number range.
In the source workbook, column B has the ID value to be matched, column C has the number value to be greater than, and column D has the number value to be less than. Lastly, the return value is in column E. The idea is to first find the range of rows (Normally around 15 rows) that have an exact ID match, and then find the first row with a number range that our lookup number falls in the middle of. This first matched row would be the row that column E data is pulled from.
So far I have tried Xlookups, as well as index-match formulas but have had no luck so far. Any idea what formula could accomplish this?
Let me know if you need any other info or if I need to clarify anything!
Thanks,
Tettchra
Use filter to return the correct arrays to the XLOOKUP:
=XLOOKUP(H2,FILTER(B:B,A:A=G2),FILTER(D:D,A:A=G2),"",-1)

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 INDEX MATCH to find specific text in column then return the ladder cell reference

I have a specific question.
I have data in column C and column AR on one sheet and in another sheet have the search text in column C and the returned value in column E.
All other columns beside Sheet1!AR have only one type of info. Column AR have several numbers divided by a comma and a space. e.g.: 0101, 2020, 0303 etc.
If e.g. 2020 is found in a cell in Sheet1!AR the value in Sheet1!C should be returned to Sheet2!E.
I have tried with below code without success.
=IFERROR(INDEX(sheet1!$C$6:$C$15000,SMALL(IF(TRIM(sheet1!$AR$6:$AR$15000)=TRIM(Sheet2!C3),ROW(sheet1!$AR$6:$AR$15000)-ROW(sheet1!$AR$6)+1),ROW('DO NOT DELETE'!1:1))),"")
What the code also does is that it hides (or stops) when there is no more rows have the desired value (this have to be part of the code and it works)
The code works fine if the cell in Sheet1!AR only have one line of numbers.
In column Sheet1!AR i have several numbers divided by a comma and a space e.g.: 0101, 2020, 0303 etc.. These numbers can differ but same number can be in more than one cell, so one cell can contain 6 numbers and another can contain only 1. In column Sheet1!Ci have unique values that i want to return to Sheet2 if the chosen number exist in column Sheet1!AR.
I don't think you need an array formula:
=IFERROR(INDEX(sheet1!$C$6:$C$15000,MATCH("*" & TRIM(Sheet2!C3) & "*",sheet1!$AR:$AR,0))

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.

How to SUM the number of duplicates in a range by given value?

A simple example as below:
Column A is the list containing all data
Column B is the list of all unique data in Column A without duplicates
Column C will be the number of duplicates for each item in Column B from Column A
How to write a easy formula for cells in Column C to sum each item in Column B from Column A?
I used =sum(lookup($a$1:$a$10=$B$1)) for C1 but received: too few arguments for this function.
A simple countif() should suffice unless I'm misunderstanding..
=COUNTIF($A$1:$A$10,B1)
Count if returns the number of times the second argument is found in the first argument (which is a range.)
With a PivotTable may be even simpler:
The unique list is created as part of constructing the PivotTable, and is sorted alphabetically. A Total may also be automatic, for control purposes.

Resources