Compare 6 columns and return non identical value - excel

I think I need a macro for what I would like to accomplish. I have 3 columns on sheet 1 and 2, but I would like to compare them and return a list under sheet 3 that has no duplicates and keeps track of the changes.
Sheet1 (New):
Count State City
1 MO STL
2 MO STP
1 FL Tampa
1 FL Ft. L
Sheet2 (Old):
Count State City
7 MO STL
6 MO STP
5 FL Tampa
4 TX Hston
Sheet3:
State City CountNew CountOld
MO STL 1 7
MO STP 2 6
FL Tampa 1 5
FL Ft.L 1
TX Hston 4
So far what I have accomplished has not help me and I cant find any other case with a situation like this one. I was trying to do this through formulas, but quickly realized thatall I was able to do was transfer the values of the columns from sheet 1 and 2, to sheet 3. But I was not able to accommodate the cell values that differ (Houston and Fort Lauderdale).
Would appreciate any help.
Thanks!

An idea would be something along these lines for finding uniques with a State & City helper column or add more to check the 2 columns?
In sheet1 and sheet 2 have a = State & "_" & City
In Sheet 3, A1 you can have =Sheet1!A1
and in A2 you can have =Sheet2!A1
then filled down from A3, you can have the following array formula
=IFERROR(IFERROR(INDEX(Sheet1!$A2:$A$10,MATCH(0,COUNTIF(Sheet3!$A$1:$A2,Sheet1!$A2:$A$10),0),1),INDEX(Sheet2!$A2:$A$10,MATCH(0,COUNTIF(Sheet3!$A$1:$A2,Sheet2!$A2:$A$10),0),1)),"")
This will give you the uniques across the 2 tabs, for normal lookups off the unique helper columns

Related

Excel: Frequency of variables using countif with &

I have two excel sheets. I am finding the frequency of variable school IDs from sheet 1 into sheet2. Lets say a student volunteers for some activity at two schools. So there is an &. I want countif to count schools even where there is &
sheet1
A B
1 Student name School ID
2 S1 Sch333 & Sch209
3 S2 Sch209
4 S3 Sch333
5 S4 Sch209 & Sch111
6 S5 Sch209
sheet2
A B
1 School ID Frequency
2 Sch209
3 Sch333
4 Sch111
Formula for frequency of school IDs in cell B2 of sheet2
=COUNTIFS('sheet1'!$b:$b,'sheet2'!a2)
This ignores the rows where there is &. Expected output
A B
1 School ID Frequency
2 Sch209 4
3 Sch333 2
4 Sch111 1
You can sum the counts for the value alone plus before or after " & "
Maybe,
In sheet2, B2 array (CSE) formula copied down :
=COUNT(SEARCH(A2,'sheet1'!$B$2:$B$100))
Remark : Array (CSE) formula to be confirmed by "Ctrl"+"Shift"+"Enter" to enter it.
According to #shrivallabha.redij, you can remplace your formula
=COUNTIFS('sheet1'!$b:$b,'sheet2'!a2)
by this one:
=COUNTIFS('sheet1'!$b:$b,"*" & 'Sheet2'!a2 & "*")

Formula for finding matching values

I have a table in excel that looks like this:
State Member DOL
MO LLC 1/1/2017
MO LLC 1/1/2017
MO TC 1/1/2017
IL TC 1/2/2017
IL LLC 1/1/2017
I am trying to use conditional formatting to highlight the whole row for any rows that have the same State, Member, and DOL value. In three seperate columns I am using a CountIf formula to find how many times each value is being used for each column: Example(=countif($A$1:$A$10,A1)). This is so that I can identify which rows have duplicates for each individual column. So in the above example my new table will look like this:
State Member DOL
3 3 4
3 3 4
3 2 4
2 2 1
2 3 4
I can't figure out what kind of formula I should use next to identify which rows are duplicates. In the example I showed, the first two rows should be the only ones highlighted because they are the only ones that have the same value for all three columns. Originally I thought that as long as all three columns have a value > than 1, then it's a duplicate. However, row's 3 and 5 in my example have duplicate values in each column, but the row itself is never actually a full duplicate. In the end, I would like some kind of formula that will give me this result in a column:
Is Duplicate
1
1
0
0
0
Anyone have any ideas?

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).

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.

How to compare 2 cells to another 2 cells in a different sheet in excel?

I want to know how to compare or know the difference of 2 cells to another 2 cells in a different sheet in excel 2007
Example:
Sheet 1
A B
1 101 KIWI
2 102 APPLE
3 103 BANANA
Sheet 2
A B
1 101 KIWI
2 102 APPLE
3 103 ORANGE
I want to show the there is a difference in 3rd row on Sheet 1 and 2
Thanks
If you put =A1&B1 in C1 of each sheet and copy down then it is like comparing single columns. So with, in D1:
in Sheet1: =MATCH(C1,Sheet2!C:C,0)
in Sheet2: =MATCH(C1,Sheet1!C:C,0)
copied down in each case the resulting numbers should show the row number where the match is on the 'other sheet' (the lists need not be sorted) and otherwise #N/A for where matches have not been found.
There is obviously no need for the concatenation for the example provided, since the two 'A' columns are identical, but I take it that was because the example was simplified.

Resources