Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Invisible spaces and the #N/A they cause

Disclosure: This is the English edition of an explainer I originally made in Japanese. It was translated with AI assistance, then reviewed and edited. Every example below uses dummy data. Two product codes look exactly the same, but VLOOKUP returns #N/A. This post shows you how an invisible space breaks the lookup, how to spot it with LEN, and how to remove it with Find & Replace. The received…

Invisible spaces can cause problems when using Excel's VLOOKUP function, as they make otherwise identical-looking values appear different to the spreadsheet program. In one example, two product codes seemed identical when viewed, both reading "A-102". However, when the VLOOKUP function searched for this code in the master list, it returned #N/A, as if the code did not exist. This happened because one code had an extra trailing space at the end, making it six characters long instead of the expected five.

To identify this hidden space, the LEN function can be used to count the number of characters in each cell. If the lengths do not match despite the cells appearing the same, a trailing space is likely the culprit. Once the extra space is discovered, Excel's Find & Replace feature can be employed to eliminate the space by replacing all instances of a single space with nothing. After removing the space, the VLOOKUP should work correctly and return the expected stock count.

One potential pitfall to watch for is the full-width space, which can appear identically to a regular space but is wider in size. This can also disrupt lookups in the same way. If the regular Find & Replace does not resolve the issue, it may be necessary to repeat the process using the full-width space as the search term. Repeated LEN checks can help ensure all invisible spaces are accounted for to avoid lookup mismatches.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How to Reduce Image Size to 100KB Without Losing Quality

How to Reduce Image Size to 100KB Without Losing Quality The visa portal wants your photo under 100KB. Yours is 312KB. You drag the quality slider down to 70, export, and get 88KB, but your face looks…

  • Focus on target file size, not quality slider
  • Target-size encoder finds highest quality under 100KB cap
  • Tools like SnapShrink adjust image to meet size limit

Renaming a Database Column Without Downtime

My earlier posts kept saying "expand and contract" without ever showing it end to end. This one does. I'll rename users.fullname to users.display_name on a live PostgreSQL database, one safe step at a…

  • Add new column displayname with nullable type during migration
  • Dual-write old fullname and new displayname columns for data consistency
  • Drop old fullname column after verifying displayname consistency

Amazon product search as JSON: prices, ratings and sponsored flags in 20 lines of Python

Amazon's official Product Advertising API requires an approved Associates account and ongoing qualifying sales. If you are building a small price monitor, competitor tracker, or catalog lookup tool…

  • Amazon Product Advertising API provides structured JSON search results
  • POST request to /amazon/search endpoint with search term and API key
  • Retrieves product details like prices, ratings, and sponsored flags

More from Wednesday 25 November →