Home » excel » excel – How to compare two maps

excel – How to compare two maps

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have a few maps in a workbook and am wondering whether there is a way to compare the specific characters that are in the same position in two maps.

For example, I have a map looking like this on sheet 1:

   A   B   C   D   E   F   G   H   I   J 
1: @   @   @   @   @   @   Z   @   @   @
2: @   @   Z   @   @   @   @   @   @   @
3: @   @   @   @   @   @   Z   @   Z   @
4: @   @   @   @   Z   @   @   @   @   @
5: @   Z   @   @   @   @   @   @   @   @
6: @   @   @   @   @   @   @   Z   Z   @
7: @   Z   @   @   @   @   @   @   @   @
8: @   @   @   @   @   @   Z   @   @   @
9: Z   @   @   @   Z   @   @   @   @   @

Another map on sheet 2 looks like this:

   A   B   C   D   E   F   G   H   I   J 
1: @   @   @   @   @   @   Z   @   @   @
2: @   @   Z   @   @   @   @   @   @   @
3: z   @   @   @   @   @   Z   @   Z   @
4: @   @   @   @   @   @   @   @   @   @
5: @   @   @   @   @   @   @   @   @   @
6: @   @   @   @   @   @   @   Z   Z   @
7: @   Z   @   @   @   @   @   @   @   @
8: @   @   @   @   @   @   @   @   @   @
9: Z   @   @   @   Z   @   @   @   @   z

Character z will be the one I wish to compare whether located at the same column same row or not.

Is there any possibility I do not require to check one by one when I am comparing both maps?

How to&Answers:

If I understand, something like:

=Sheet1!A1=A1  

in say L1 of Sheet2, copied across to U1 and then L1:U1 copied down to L9 should indicate where there are differences.


The solution presently chosen by the OP (see Comment) is not the above, though a variation of the above:

=IF(A1="z",Sheet1!A1=A1,"")  

This accurately identifies which cells in Sheet2 are occupied with z or Z that, for the same position are not occupied by z or Z in Sheet1 (ie A3 and J9).

For the example this happens to identify all the differences because Sheet2 is effectively a copy of Sheet1 except that two zs in Sheet2 replace two @s in Sheet1.

This may be all OP wants but does not cover identification that, for example, the E4 cells are different. If “present in Sheet1 and not present in Sheet2” is of interest it could be addressed either by repeating the formula above in Sheet1 (with change of Sheet1 to Sheet2):

=IF(A1="z",Sheet2!A1=A1,"")  

to detect differences in E4, B5 and G8, or, if just to display in a single sheet (say Sheet2) a slightly more elaborate formula such as:

=IF(AND(A1="z",Sheet1!A1="z"),"-",IF(AND(A1="z",Sheet1!A1<>"z"),2,IF(AND(A1<>"z",Sheet1!A1="z"),1,"")))  

for a result of this kind:

SO23945826 example

where:

blanks = no z or Z in that position on either sheet
hyphen = z or Z in that position on both sheets
1 = z or Z on Sheet1 and not on Sheet2
2 = z or Z on Sheet2 and not on Sheet1