• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

MATCH MISMATCH FORMULA

This formula check data in C1,D1 in A:A & B:B could it be extended to check of

D1,E1 & F1 in A:A, B:B & C:C ?

formula is

=IF(C2="", "", IF(D2=INDEX(B$2:B$65536, MATCH(C2,A$2:A$65536, 0)), "", "mismatch"))
 
Hi ,


I am not sure this formula is doing what you want it to do ; I'll just describe in so many words what it does ; please confirm whether that is what you expect it to do.


1. If cell C2 is blank , return blank ; so if C2 does not have any data , the cell in which this formula is present will also remain blank.


2. If C2 does contain data , then match that data with any cell in column A ( A2:A65536 ) ; if a match is not found , the cell displays #N/A ; is this expected ?


3. If the value in C2 matches any cell in column A , then check whether the corresponding value in column B matches the value in cell D2 ; if it does , return a blank , otherwise display "mismatch".


4. The formula does not specify what should happen if there is more than one match for C2 in column A ; as it stands , only the first match will always be considered. Is this what you want ?


Narayan
 
Let me describe it clearly my friend....

I have Data based On three columns A is Container No. B=Destination C Quantity of packages and Same Data we receive From the Terminal So i place my Data in the data i receive from the terminal in 1 sheet and Check either container No. aphu-1234567 for Destination NYH with Quantity 123 is same In the Terminals record or not...

sometimes we have wrong container no or terminal provides wrong container no. for e.g: Aphu1234568 or Destination is given wrong! or Quantity of packages is given wrong...

for eg Container No with us is UESU1234567 and terminals record says APHU1234567 so we need to check that!... or Destination with us is NHY (New York) terminal gives it for CCO (Chicago)


1. Yes it will remain blank..

2. well it results in to #N/A if C2 is Not found in A:A it gives #NA for container

3. IF D2 is not found in B:B so it given Mismatch....and for Dest. or QTY

4. there cannot be more then 1 same Container No. with same Prefix and No.


Well based on extending the fromula into 3 X 3 columns if container is not Found so formula should says Box Mismatch, if destination so it should says Dest Mismatch and sames for Quantity...
 
Hi ,


I have understood some of it , but not all of it ; can you clarify ?


1. Data consists of three items - Container No. , Destination and Quantity of packages


2. This data is recorded at the source , let us say in one sheet.


3. The same data comes back to you from the terminal , which I assume is recorded on another sheet.


4. You need to compare the data recorded at the source ( step 2 above ) with the data recorded at the terminal ( step 3 above ) ; these two records can differ in any of the items viz. Container No. , Destination or Quantity of packages.


5. When you are comparing two records , you have to do so based on one item which is identical in the two records ; I assume this is the Container No. ; for every Container No. , we retrieve the two records and check whether each item matches.


6. If the mistake is in the Container No. itself , then how do we decide that the two records which we are trying to compare are the correct records ? Can you clarify this point ?


Narayan
 
1. yes

2. yes our data is in 1 sheet

3. yes in 2 sheet & then i place Our in is ABC & Terminals data in DEF..so DEF shall check A:A B:B & C:C

4. Yes we need to compare Terminals data with Our data.exactly Can differ in any Items..

5. Yes Container should match each other destination with destination and QTY with QTY but condition is that 3 items checking should be interlinked!..& Each Item matches..for eg IF terminals data is in Row 54 and and Our data is in Row 2 so checking should be based on the Dynamic range..not row to row checking...

6. IF the Container no. is not same in both so it should show Container Mismatch, IF Destination so Destination mismatch If both Container and Destination are same and QTY is not so it should say QTY Mismatch
 
Hi ,


Thanks for the clarifications. I am sorry but it is late for me , and I can do something only tomorrow morning. Hopefully others will help out.


Narayan
 
Hi ,


Can you check out the following link ?


https://skydrive.live.com/#!/view.aspx?cid=754467BA13646A3F&resid=754467BA13646A3F%21151


Narayan
 
Hi xcruc1at3r and NARAYANK991


Here is another method, one that identifies all possible error combinations


https://skydrive.live.com/redir.aspx?cid=9a0721b634391421&resid=9A0721B634391421!143&parid=9A0721B634391421!136
 
Friends from Office i cannot access Storage sites like Skydrive. :(... can only use google doc...

can u simply paste the Formula in here!!
 
Hi ,


This file includes Kyle's formulae which are independent of what I have entered. You can use whichever you want.


https://docs.google.com/spreadsheet/ccc?key=0AkKMpuzr3MTVdDBTTTNaSFZHU25LdFhWVzVyMGNlS2c


Narayan
 
I posted the link earlier without time to explain what I had done. Here is the method that I used so people don't need to download from the link. I used Narayank991's file for the data

[pre]
Code:
On sheet 1 - "data from source 1" - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	2345
1104	             DYH	3456
1105	             KLM	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1111	             IND	1765
1113	             IND	4356
1114	             AUS	3245

On sheet 2 - "data from source 2" the data to compare against - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	3456
1104	             DYH	3456
1105	             KLH	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1110	             IND	1765
1113	             IND	4445
1114	             AUS	3245

off to the side I have a lookup table for the index/match used in the formula - this is in Sheet1 H1:I8

0	No Match
1	Destination & Quantity Mismatch
2	Container & Quantity Mismatch
3	Quantity Mismatch
4	Container & Destination Mismatch
5	Destination Mismatch
6	Container Mismatch
7	Perfect Match
[/pre]
Formula used: enter in G2

=INDEX($I$1:$I$8,MATCH(LARGE(MMULT(--(A2:C2=Sheet2!$A$2:$C$12),{1;2;4}),1),$H$1:$H$8,1))


Using the MMULT function, which I handily just picked up with the first post from derek in "Formula Forensics 008", you can multiply two arrays(matrices) together and sum the results.


So stepping through the first cell, G2:


--(A2:C2=Sheet2!$A$2:$C$12)

This is checking the container ID, destination, quantity against the data in sheet2. Pressing F9 when this is selected gives you this:

{1,1,1;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}

As it so happens the first row of data in sheet2 is a full match, evidenced by the three consecutive #1s separated by commas.

This result is multiplied with the second array in MMULT, {1;2;4} [notice the semi-colons - this is a requirement of MMULT, the second array must have the same number of rows (;) as the first array has columns (,)]


The result of multiplying the two together would give you this (can't be seen with F9)

{1,2,4;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}


The end result of MMULT is this:

{7;0;0;0;0;0;0;0;0;0;0}

You might want to look up matrix multiplication to see how it gets to this result, but effectively in this case, the columns are summed together, 1+2+4 = 7


The LARGE function finds the first largest value, 7 here, which pulls into the INDEX/MATCH lookup table and finds 7 "Perfect Match".


LARGE({7;0;0;0;0;0;0;0;0;0;0},1) = 7

MATCH(7,$H$1:$H$8,1) = 8

INDEX($I$1:$I$8,8) = "Perfect Match"


I don't know the technical term for the second array, {1;2;4}, but using it provides for a unique number for each unique combination of matches. If you have 4 criteria, rather than 3 in this example, the second array would be {1;2;4;8} - the next number is double the previous.
 
I posted the link earlier without time to explain what I had done. Here is the method that I used so people don't need to download from the link. I used Narayank991's file for the data

[pre]
Code:
On sheet 1 - "data from source 1" - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	2345
1104	             DYH	3456
1105	             KLM	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1111	             IND	1765
1113	             IND	4356
1114	             AUS	3245

On sheet 2 - "data from source 2" the data to compare against - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	3456
1104	             DYH	3456
1105	             KLH	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1110	             IND	1765
1113	             IND	4445
1114	             AUS	3245

off to the side I have a lookup table for the index/match used in the formula - this is in Sheet1 H1:I8

0	No Match
1	Destination & Quantity Mismatch
2	Container & Quantity Mismatch
3	Quantity Mismatch
4	Container & Destination Mismatch
5	Destination Mismatch
6	Container Mismatch
7	Perfect Match
[/pre]
Formula used: enter in G2

=INDEX($I$1:$I$8,MATCH(LARGE(MMULT(--(A2:C2=Sheet2!$A$2:$C$12),{1;2;4}),1),$H$1:$H$8,1))


Using the MMULT function, which I handily just picked up with the first post from derek in "Formula Forensics 008", you can multiply two arrays(matrices) together and sum the results.


So stepping through the first cell, G2:


--(A2:C2=Sheet2!$A$2:$C$12)

This is checking the container ID, destination, quantity against the data in sheet2. Pressing F9 when this is selected gives you this:

{1,1,1;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}

As it so happens the first row of data in sheet2 is a full match, evidenced by the three consecutive #1s separated by commas.

This result is multiplied with the second array in MMULT, {1;2;4} [notice the semi-colons - this is a requirement of MMULT, the second array must have the same number of rows (;) as the first array has columns (,)]


The result of multiplying the two together would give you this (can't be seen with F9)

{1,2,4;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}


The end result of MMULT is this:

{7;0;0;0;0;0;0;0;0;0;0}

You might want to look up matrix multiplication to see how it gets to this result, but effectively in this case, the columns are summed together, 1+2+4 = 7


The LARGE function finds the first largest value, 7 here, which pulls into the INDEX/MATCH lookup table and finds 7 "Perfect Match".


LARGE({7;0;0;0;0;0;0;0;0;0;0},1) = 7

MATCH(7,$H$1:$H$8,1) = 8

INDEX($I$1:$I$8,8) = "Perfect Match"


I don't know the technical term for the second array, {1;2;4}, but using it provides for a unique number for each unique combination of matches. If you have 4 criteria, rather than 3 in this example, the second array would be {1;2;4;8} - the next number is double the previous.
 
I posted the link earlier without time to explain what I had done. Here is the method that I used so people don't need to download from the link. I used Narayank991's file for the data

[pre]
Code:
On sheet 1 - "data from source 1" - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	2345
1104	             DYH	3456
1105	             KLM	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1111	             IND	1765
1113	             IND	4356
1114	             AUS	3245

On sheet 2 - "data from source 2" the data to compare against - A1:C12

Container No.	Destination	Quantity
1102	             MAS	1234
1103	             SGP	3456
1104	             DYH	3456
1105	             KLH	4567
1106	             QRT	5678
1107	             FRN	6789
1108	             ESP	7890
1109	             ITA	1098
1110	             IND	1765
1113	             IND	4445
1114	             AUS	3245

off to the side I have a lookup table for the index/match used in the formula - this is in Sheet1 H1:I8

0	No Match
1	Destination & Quantity Mismatch
2	Container & Quantity Mismatch
3	Quantity Mismatch
4	Container & Destination Mismatch
5	Destination Mismatch
6	Container Mismatch
7	Perfect Match
[/pre]
Formula used: enter in G2

=INDEX($I$1:$I$8,MATCH(LARGE(MMULT(--(A2:C2=Sheet2!$A$2:$C$12),{1;2;4}),1),$H$1:$H$8,1))


Using the MMULT function, which I handily just picked up with the first post from derek in "Formula Forensics 008", you can multiply two arrays(matrices) together and sum the results.


So stepping through the first cell, G2:


--(A2:C2=Sheet2!$A$2:$C$12)

This is checking the container ID, destination, quantity against the data in sheet2. Pressing F9 when this is selected gives you this:

{1,1,1;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}

As it so happens the first row of data in sheet2 is a full match, evidenced by the three consecutive #1s separated by commas.

This result is multiplied with the second array in MMULT, {1;2;4} [notice the semi-colons - this is a requirement of MMULT, the second array must have the same number of rows (;) as the first array has columns (,)]


The result of multiplying the two together would give you this (can't be seen with F9)

{1,2,4;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0}


The end result of MMULT is this:

{7;0;0;0;0;0;0;0;0;0;0}

You might want to look up matrix multiplication to see how it gets to this result, but effectively in this case, the columns are summed together, 1+2+4 = 7


The LARGE function finds the first largest value, 7 here, which pulls into the INDEX/MATCH lookup table and finds 7 "Perfect Match".


LARGE({7;0;0;0;0;0;0;0;0;0;0},1) = 7

MATCH(7,$H$1:$H$8,1) = 8

INDEX($I$1:$I$8,8) = "Perfect Match"


I don't know the technical term for the second array, {1;2;4}, but using it provides for a unique number for each unique combination of matches. If you have 4 criteria, rather than 3 in this example, the second array would be {1;2;4;8} - the next number is double the previous.
 
I really appreciate your effort.. kyle.. but the Perfect Match should be based on 1 sheet dynamic search!....

for e.g

in sheet 1 if the data is in row 1 and in sheet 2 the same data is in row 100.. or any where in between A:A, B:b & C:C so it should says Perfect Match!... because untill an unless the Data mistakes are not cleared so data sequence cannot match the sequence order cause of the type error...

1234.....ABC......45

can it be moved from range to A:A !! B:B n C:C ?

why does perfect match & in other results it reflects Row No?

QTY & Destination could Duplicates as well !!..
 
Hi...Kyle McGhee


I have an doubt regarding this formula, In formula you have used --(A2:C2=Sheet2!$A$2:$C$12), what does "--" it implies, how we can use in any formula?


Thanks in advance
 
I really appreciate your effort.. kyle.. but the Perfect Match should be based on 1 sheet dynamic search!....

for e.g

in sheet 1 if the data is in row 1 and in sheet 2 the same data is in row 100.. or any where in between A:A, B:b & C:C so it should says Perfect Match!... because untill an unless the Data mistakes are not cleared so data sequence cannot match the sequence order cause of the type error...

1234.....ABC......45

can it be moved from range to A:A !! B:B n C:C ?

why does perfect match & in other results it reflects Row No?

QTY & Destination could Duplicates as well !!..
 
Hi, xcruc1at3r!


As this post goes on open, I decided to give a look, so I apologize if I misunderstand or analyze something in a superfluos way.


I downloaded Kyle McGhee's last file, and it seems to work perfectly for me. Reading your last post, I moved Container 1102 in Sheet2 from row 2 to row 10, and it performed OK the test and went on displaying a Yes in Perfect Match. Is that what you just said it didn't work because didn't check in all rows?


Regards!
 
My apologies, I have been having a very busy week, unable to reply.

Thanks SirJB7 for stepping in.


xcruc1at3r,


If I understand your question, you are asking if the range can be extended to include the whole column? A:A, B:C, C:C? I wouldn't recommend trying. I would use a dynamic named range to limit the number of cells compared to.


I added a column to check for duplicate or missing container numbers, anything that is not a 1 should be investigated. I also added a column that references the cell that the match was found on sheet 2, just click the hyperlink and it will take you directly to the cell.


Let me know if there was something I missed in your comment.

The link to the updated file is the same as my last link but here it is again


https://skydrive.live.com/redir.aspx?cid=9a0721b634391421&resid=9A0721B634391421!143&parid=9A0721B634391421!136


Also, I should mention that there are deficiencies in NARAYANK991's method. The composite search in column D of NARAYANK991's file works as expected, but the individual checks for dest and qty will not return correct results. This is because the formula is using the match function, which returns the first instance of the lookup value found. So if containers 1234 and 2345 were heading to India, but container 2345 had Australia on Sheet2, it would still pull a "match" (assuming container 1234 was before 2345 and correctly had India on sheet2).


Thanks
 
@Kyle McGhee

Hi!

Don't even mention it, I was just looking around, I tried what you uploaded, it worked fine (and elegantly, I should say), so when I read xcruc1at3r's last comment I wrote explaining what I've done. No comment's 'til now... should we assume your file does the job?

Regards!

PS: commented too on a related topic started by himself too and related to this -I think-, here's the link: http://chandoo.org/forums/topic/macro-for-compare-3-columns-in-sheet-1-with-sheet2-then-add-sheet1-fourth-colum
 
Back
Top