Compare a column has duplicate cells and then compare duplicate cells again on corresponding column - excel-formula

I want to find the duplicate cells in Item Name. For example A is duplicated. And then compare the duplicate content from Item Name A. Therefore, row 2 and row 6 are duplicated. How to setup the equation to determine the duplication?
1 Item Name Content Dupicate?
2 A Mary Y
3 B Peter N
4 C John N
5 A Mary Y
6 B Paul N
7 A Peter N

If Items are in ColumnB and Names in ColumnC I think a suitable formula might be:
=IF(COUNTIFS($C$2:$C$7,C2,$B$2:$B$7,B2)>1,"Y","N")

Related

Excel Count rows where value in Column A has a duplicate in column B and that duplicate's other value in Column A equals something

Given the table below:
A
B
C
D
1
happy
1-veggies
GHF
1
sad
1-veggies
HGF
2
angry
1-veggies
GHG
2
sad
1-veggies
FGH
3
sad
1-veggies
HGF
4
moody
2-meat
FFF
4
sad
2-meat
HGF
5
excited
2-meat
HGF
I need to count the number of rows where C="1-veggies", B="sad", A has a duplicate within A and whose alternative rows in A have a value in D = "GHF" or "FGH".
The result should be 1 based on the second row.
The second row has B= "sad", C = "1-veggies", A has a duplicate within A, whose value is "1" and the 1st row, also with A = "1" has a value in D = "GHF".
I already have a formula as follows:
=SUMPRODUCT((B1:B8="sad")*(COUNTIF(A1:A8,A1:A8)>1)*(C1:C8="1-veggies")*(D1:D8="GHF"))
However, it isn't able to check the 1st row nor does it check the necessary OR statement on column D.
I don't know how to accomplish either task. Thank you.
Add some more COUNTIFS():
=SUMPRODUCT((B1:B8="sad")*(COUNTIF(A1:A8,A1:A8)>1)*(C1:C8="1-veggies")*(COUNTIFS(A1:A8,A1:A8,B1:B8,"<>sad",D1:D8,"GHF")+COUNTIFS(A1:A8,A1:A8,B1:B8,"<>sad",D1:D8,"FGH")>0))
Basically you want to select rows where C="1-veggies", B="sad" and join them to rows where D = "GHF" or "FGH", but with a condition that the value in column A is equal in both but the row number is unequal. This might be a good use of Power Query for users who are expert in this, but using formulas is problematic because of the limitations of countifs (has to be a range). A workaround if you have Excel 365 would be to use some filters followed by countifs:
Column E
=FILTER(A1:A8,(B1:B8="sad")*(C1:C8="1-veggies"))
Coumn F
=FILTER(ROW(A1:A8),(B1:B8="sad")*(C1:C8="1-veggies"))
Column G
=FILTER(A1:A8,(D1:D8="GHF")+(D1:D8="FGH"))
Column H
=FILTER(ROW(A1:A8),(D1:D8="GHF")+(D1:D8="FGH"))
Then
=SUM(COUNTIFS(E1#,G1#,F1#,"<>"&H1#))

INDEX MATCH obtaining values for duplicate names

I have one example table with the following data in Sheet1 with the following random data
------A ----------------- B ----------------------C ------------------------D
1 --First--------------Last-----------------Start Date--------------End Date
2 --John--------------Smith--------------08/08/2014------------01/01/2015
3---John--------------Smith--------------08/11/2014------------17/11/2014
4---John--------------Smith--------------06/06/2014------------23/12/2014
5---Abel--------------Jones--------------14/05/2014------------29/04/2015
6---Abel--------------Jones--------------04/07/2014------------26/04/2015
Then I have another table in Sheet2
------A ----------------- B ----------------------C ------------------------D
1 --First--------------Last-----------------Start Date--------------End Date
2 --John--------------Smith---------------------------------------------------
3---John--------------Smith---------------------------------------------------
4---John--------------Smith---------------------------------------------------
5---Abel--------------Jones---------------------------------------------------
6---Abel--------------Jones---------------------------------------------------
I am using INDEX MATCH to transfer the data between the two sheets.
=INDEX(Sheet1!$C:$C,
MATCH(1,INDEX((Sheet1!$A:$A=$A3)*(Sheet1!$B:$B=$B3),0),0))
To populate column C with the start dates from Sheet1.
=INDEX(Sheet1!$D:$D,
MATCH(1,INDEX((Sheet1!$A:$A=$A3)*(Sheet1!$B:$B=$B3),0),0))
and this to populate column D with the end dates.
The problem is, when I perform this INDEX MATCH function, for a duplicate name, it will only copy over the first value. So this formula will paste 08/08/2014 into all 'John Smith' Start dates in column C of Sheet2.
How do I obtain all values so that C2 should be 08/08/2014, C3 should be 08/11/2014, C4 should be 06/06/2014 etc.
One solution would be to insert a column in both sheets with a "running count" of instances of the same name. For example, insert col C and in C2 enter =IF(A2&B2 = A1&B1, C1+1, 1). This starts the count at 1 if the concatenated first and last name is new, and increases the previous count by 1 if not. So you would have
First Last Count by Person
John Smith 1
John Smith 2
John Smith 3
Abel Jones 1
Abel Jones 2
George Washington 1
Thomas Jefferson 1
Thomas Jefferson 2
You can then add this column to your MATCH() function (and change the lookup column as necessary).
Edit: It is worth noting that this requires your raw data is sorted by name.
You can narrow the $A:$A refferances to something like $Ax+1:$Ay where y = last row of your excel sheet and x is position of previous occurance of this name/surname (you could store this in some dummy column).

Find duplicates with a suffix in excel and keep results

I have a spreadsheet with a list of items in one column (A) and in column C shows the total sold. I'm trying to find all the items within column A.
The issue is, some items are the same, only they have a suffix, mostly separated by a -. The values in column C would be different as well.
Example:
ABC = 5
ABC-123 = 3
ABC-543 = 2
I'm looking to identify only 123 and then combine all the values, so that it will show ABC and 10 as the total.
I've looked around how to remove the duplicate suffix, but have so far failed to find a method when trying to add the total values.
Many thanks
do you mean the data you have looks like this:
column A column B column C
ABC 5
ABC-123 3
ABC-543 2
if so, you can select column A then go to data then text to columns then delimited select other by putting - sign, next and finish.
result must be:
column A column B column C
ABC 5
ABC 123 3
ABC 543 2
then you can =sumifs(C:C;A:A;"ABC") (keep in mind that column B must be empty)
if you have ABC-123 = 3 in the same cell as a text, then you can do:
=IF(SEARCH("ABC";F3);RIGHT(F3;LEN(F3)-FIND("=";F3)-1);"")
where F3 is equal to ABC-123 = 3 The formula above searches fo ABC and gives you a value after = sign, no matter how long this value is. If there is no ABC it will return an error.
if there is no need to look for ABC then just use:
=RIGHT(F3;LEN(F3)-FIND("=";F3)-1)
I hope this helps. I cannot comment, so ask if you have questions.
Best - AB

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Merge unique values if another cell matches

Merge all unique values if another cell matches. I already know how to merge cells but now some information is double. So what I would like to achieve is the following:
if column A has the same name, then all values given in column B for
that name must be given only ONCE in a new column.
My data has a row names and a row mode, for example (Row 1 is header)
A B
2 Brenda a
3 Brenda a
4 Joey a
5 Joey b
So I want:
E
2 a
3
4 a,b
5
I already did merge the modes in column 3:
=IF(A1<>A2;B2;C1&","&B2)
So I get in this example:
C
2 a
3 a,a
4 a
5 a,b
Then, I already did that only the first record get the additional modes in column 4:
=IF(A1=A2;"";INDEX(Sheet1!$C:$C;COUNTIF(Sheet1!$A:$A;$A2)+MATCH($A2;Sheet1!$A:$A;0) -1))
So I get in this example
D
2 a,a
3
4 a,b
5
Now I need a column that only uniques values are given for each name. So in this example:
E
2 a
3
4 a,b
5
If I am understanding how your data is structured, try this:
Add a new column, say column G for ease of explanation, that concatenates the name and mode in each row. So, cell G2="Brendaa", G3="Brendaa", G4="Joeya", G5="Joeyb", etc.
In your merge step you will test whether the current value in the cell for this column matches any previous values in the column: If no, you do the merge; if yes, you don't.
Your merge formula would change to something like the following:
=IF(A1<>A2,B2,IF(ISERROR(VLOOKUP(G2,G$1:G1,1,0)),C1&","&B2,""))
Then you would the next step as before.

Resources