Techincal Note: Calculating Hamming Distances Between Two Binary Strings in Excel

I haven’t seen anywhere that does this, so here’s how to calculate the Hamming distance between two binary strings in excel.

Say you have two binary strings, say 001001 and 100100. How do you calculate their Hamming distance? It turns out it isn’t that easy in Excel, but is possible.

How do we calculate the Hamming distance between 100 and 011 in the cube above, shown as the shortest (red) line joining these two points?

To cut to the chase, the formula for calculating the Hamming distance between strings in cell A1 and B1 is:

Thanks. It helps.