Resources

Why are two identical-looking values not equal to each other?

Just because data looks identical, it doesn't mean it is.

That's the key message of this video, which demonstrates how two values that look the same are actually different.

@globalexcelsummit Just because data looks identical, it doesn't mean it is. ย  That's the key message of this video, which demonstrates how two values that look the same are actually different. ย  'Hello world' is contained in cells B2 and B3, each referred to as Value A and Value B, respectively. After testing them for equality using =๐™ฑ๐Ÿธ=๐™ฑ๐Ÿน, FALSE is returned. Their lengths are then checked for any trailing spaces. There turns out to be one in Value A, but even after removing it, the equality test does not change. ย  The difference only becomes apparent after returning the Unicode numbers for the spaces that separate the two words. This is done using =๐š„๐™ฝ๐™ธ๐™ฒ๐™พ๐™ณ๐™ด(๐™ผ๐™ธ๐™ณ(๐™ฑ๐Ÿธ:๐™ฑ๐Ÿน,๐Ÿผ,๐Ÿท)). ย  ๐˜œ๐˜ฏ๐˜ช๐˜ค๐˜ฐ๐˜ฅ๐˜ฆ ๐˜ช๐˜ด ๐˜ข ๐˜ถ๐˜ฏ๐˜ช๐˜ท๐˜ฆ๐˜ณ๐˜ด๐˜ข๐˜ญ ๐˜ฆ๐˜ฏ๐˜ค๐˜ฐ๐˜ฅ๐˜ช๐˜ฏ๐˜จ ๐˜ด๐˜ต๐˜ข๐˜ฏ๐˜ฅ๐˜ข๐˜ณ๐˜ฅ ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ฉ๐˜ข๐˜ด ๐˜ข ๐˜ถ๐˜ฏ๐˜ช๐˜ฒ๐˜ถ๐˜ฆ ๐˜ท๐˜ข๐˜ญ๐˜ถ๐˜ฆ ๐˜ข๐˜ด๐˜ด๐˜ช๐˜จ๐˜ฏ๐˜ฆ๐˜ฅ ๐˜ต๐˜ฐ ๐˜ฆ๐˜ท๐˜ฆ๐˜ณ๐˜บ ๐˜ค๐˜ฉ๐˜ข๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ฆ๐˜ณ, ๐˜ด๐˜บ๐˜ฎ๐˜ฃ๐˜ฐ๐˜ญ, ๐˜ข๐˜ฏ๐˜ฅ ๐˜ด๐˜ค๐˜ณ๐˜ช๐˜ฑ๐˜ต ๐˜ถ๐˜ด๐˜ฆ๐˜ฅ ๐˜ช๐˜ฏ ๐˜ญ๐˜ข๐˜ฏ๐˜จ๐˜ถ๐˜ข๐˜จ๐˜ฆ๐˜ด ๐˜ธ๐˜ฐ๐˜ณ๐˜ญ๐˜ฅ๐˜ธ๐˜ช๐˜ฅ๐˜ฆ. ๐˜๐˜ต๐˜ด ๐˜ฑ๐˜ถ๐˜ณ๐˜ฑ๐˜ฐ๐˜ด๐˜ฆ ๐˜ช๐˜ด ๐˜ต๐˜ฐ ๐˜ฆ๐˜ฏ๐˜ด๐˜ถ๐˜ณ๐˜ฆ ๐˜ต๐˜ฉ๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ด๐˜ช๐˜ด๐˜ต๐˜ฆ๐˜ฏ๐˜ต ๐˜ณ๐˜ฆ๐˜ฑ๐˜ณ๐˜ฆ๐˜ด๐˜ฆ๐˜ฏ๐˜ต๐˜ข๐˜ต๐˜ช๐˜ฐ๐˜ฏ ๐˜ฐ๐˜ง ๐˜ต๐˜ฆ๐˜น๐˜ต ๐˜ข๐˜ค๐˜ณ๐˜ฐ๐˜ด๐˜ด ๐˜ฅ๐˜ช๐˜ง๐˜ง๐˜ฆ๐˜ณ๐˜ฆ๐˜ฏ๐˜ต ๐˜ฑ๐˜ญ๐˜ข๐˜ต๐˜ง๐˜ฐ๐˜ณ๐˜ฎ๐˜ด ๐˜ข๐˜ฏ๐˜ฅ ๐˜ฅ๐˜ฆ๐˜ท๐˜ช๐˜ค๐˜ฆ๐˜ด. ย  Inside UNICODE, MID is nested and the range is specified before putting a ๐šœ๐š๐šŠ๐š›๐š_๐š—๐šž๐š– of 6 as both spaces are the sixth character. A ๐š—๐šž๐š–_๐šŒ๐š‘๐šŠ๐š›๐šœ of 1 is also added to extract only that character. ย  The Unicode numbers returned are 32 and 160, proving there is a difference. Value A's space is copied across and pasted to replace Value B's. With both now featuring spaces that use number 32, all things are equal and TRUE is returned. ย  You might encounter this problem if you copy and paste something from the web. Nevertheless, it's worth being aware of when you're cleaning and transforming your data because it can mess up your analysis in a very sneaky way. ย  #exceleration #excelย #microsoftexcel #excelformulas #exceltips #globalexcelsummit โ™ฌ original sound - globalexcelsummit

'Hello world' is contained in cells B2 and B3, each referred to as Value A and Value B, respectively. After testing them for equality using =๐™ฑ๐Ÿธ=๐™ฑ๐Ÿน, FALSE is returned. Their lengths are then checked for any trailing spaces. There turns out to be one in Value A, but even after removing it, the equality test does not change.

The difference only becomes apparent after returning the Unicode numbers for the spaces that separate the two words. This is done using =๐š„๐™ฝ๐™ธ๐™ฒ๐™พ๐™ณ๐™ด(๐™ผ๐™ธ๐™ณ(๐™ฑ๐Ÿธ:๐™ฑ๐Ÿน,๐Ÿผ,๐Ÿท)).

Unicode is a universal encoding standard that has a unique value assigned to every character, symbol, and script used in languages worldwide. Its purpose is to ensure the consistent representation of text across different platforms and devices.โ€

Inside UNICODE, MID is nested and the range is specified before putting a ๐šœ๐š๐šŠ๐š›๐š_๐š—๐šž๐š– of 6 as both spaces are the sixth character. A ๐š—๐šž๐š–_๐šŒ๐š‘๐šŠ๐š›๐šœ of 1 is also added to extract only that character.

The Unicode numbers returned are 32 and 160, proving there is a difference. Value A's space is copied across and pasted to replace Value B's. With both now featuring spaces that use number 32, all things are equal and TRUE is returned.

You might encounter this problem if you copy and paste something from the web. Nevertheless, it's worth being aware of when you're cleaning and transforming your data because it can mess up your analysis in a very sneaky way.

For more Excel tips and tricks like this, check out our Video Tutorials page.

Andrew Moss
About the Author

Andrew Moss

Andrew is a technical writer who specialises in Microsoft Excel and data analysis. He has published hundreds of articles and social media posts aimed at helping people enhance their skills and spreading good practices.

Conversation

0 Comments

As you comment, let's keep the discussion friendly and respectful to add value to the conversation.

Thank you! Your comment has been sent!
Oops! Something went wrong while submitting the form.
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete

Get Tickets

Benefit from an award-winning 3-day conference plus access to exclusive networking and additional Masterclass events.

Get Tickets
Close Cookie Popup
Cookie Preferences
By clicking โ€œAccept Allโ€, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts as outlined in our privacy policy.
Strictly Necessary (Always Active)
Cookies required to enable basic website functionality.
Cookies helping us understand how this website performs, how visitors interact with the site, and whether there may be technical issues.
Cookies used to deliver advertising that is more relevant to you and your interests.
Cookies allowing the website to remember choices you make (such as your user name, language, or the region you are in).