---
title: "Fix a VLOOKUP that fails on a space | PracticeExcel"
description: "Practice fixing VLOOKUP #N/A in a live spreadsheet: remove an extra space from the lookup value with TRIM."
canonical_url: "https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces"
locale: en
meta:
  "og:description": "Practice fixing VLOOKUP #N/A in a live spreadsheet: remove an extra space from the lookup value with TRIM."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Fix%2Ba%2BVLOOKUP%2Bthat%2Bfails%2Bon%2Ba%2Bspace%2Cdescription_~UHJhY3RpY2UgZml4aW5nIFZMT09LVVAgI04vQSBpbiBhIGxpdmUgc3ByZWFkc2hlZXQ6IHJlbW92ZSBhbiBleHRyYSBzcGFjZSBmcm9tIHRoZSBsb29rdXAgdmFsdWUgd2l0aCBUUklNLg%2Ceyebrow_VLOOKUP%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRyJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJDb2RlIiwiUHJvZHVjdCIsIlByaWNlIiwiUHJpY2UiXX0seyJuIjoyLCJjZWxscyI6WyJBMTAiLCJQZW4iLCIxMiIsIiJdfSx7Im4iOjMsImNlbGxzIjpbIkIyMCIsIk5vdGVib29rIiwiMzUiLCIiXX0seyJuIjo0LCJjZWxscyI6WyJDMzAiLCJTdGFwbGVyIiwiODkiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJENDAiLCJGb2xkZXIiLCIyNCIsIiJdfV0sInRhcmdldCI6WzEsM119fQ%2Cp_Ii9wcmFjdGljZS92bG9va3VwL3Zsb29rdXAtdHJpbS1zcGFjZXMi%2Cs_ev7T9MB3kEJHKZ70.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Fix a VLOOKUP that fails on a space | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Fix%2Ba%2BVLOOKUP%2Bthat%2Bfails%2Bon%2Ba%2Bspace%2Cdescription_~UHJhY3RpY2UgZml4aW5nIFZMT09LVVAgI04vQSBpbiBhIGxpdmUgc3ByZWFkc2hlZXQ6IHJlbW92ZSBhbiBleHRyYSBzcGFjZSBmcm9tIHRoZSBsb29rdXAgdmFsdWUgd2l0aCBUUklNLg%2Ceyebrow_VLOOKUP%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRyJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJDb2RlIiwiUHJvZHVjdCIsIlByaWNlIiwiUHJpY2UiXX0seyJuIjoyLCJjZWxscyI6WyJBMTAiLCJQZW4iLCIxMiIsIiJdfSx7Im4iOjMsImNlbGxzIjpbIkIyMCIsIk5vdGVib29rIiwiMzUiLCIiXX0seyJuIjo0LCJjZWxscyI6WyJDMzAiLCJTdGFwbGVyIiwiODkiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJENDAiLCJGb2xkZXIiLCIyNCIsIiJdfV0sInRhcmdldCI6WzEsM119fQ%2Cp_Ii9wcmFjdGljZS92bG9va3VwL3Zsb29rdXAtdHJpbS1zcGFjZXMi%2Cs_ev7T9MB3kEJHKZ70.png"
---

> Index of every page on this site: [llms.txt](https://practiceexcelonline.com/llms.txt)

# **Fix a VLOOKUP that fails on a space**

**Premium**

The code in F2 was pasted from an email and ends with a space, so a plain VLOOKUP returns #N/A. In G2, look up the price with TRIM(F2) as the lookup value.

G2fx

|  | A | B | C | D | E | F | G | H |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | Code | Product | Price |  |  | Code | Price | |
| 2 | A10 | Pen | 12 |  |  | C30 |  | |
| 3 | B20 | Notebook | 35 |  |  |  |  | |
| 4 | C30 | Stapler | 89 |  |  |  |  | |
| 5 | D40 | Folder | 24 |  |  |  |  | |
| 6 |  |  |  |  |  |  |  | |
| 7 |  |  |  |  |  |  |  | |
| 8 |  |  |  |  |  |  |  | |

**Premium lesson**

## **Unlock VLOOKUP and every other lesson**

This is a premium lesson. Premium lets you solve it and every other lesson, take the timed mock tests, and earn certificates you can share on LinkedIn.

Next with premium:**INDEX and MATCH****XLOOKUP**

It comes up in this mock test: [**Excel assessment (Indeed format)**](https://practiceexcelonline.com/tests/indeed-excel-assessment)

[**See plans, from $5/month**](https://practiceexcelonline.com/pricing) [**Already premium? Sign in**](https://practiceexcelonline.com/login?next=/practice/vlookup/vlookup-trim-spaces)

Need help?

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#webpage","description":"Practice fixing VLOOKUP #N/A in a live spreadsheet: remove an extra space from the lookup value with TRIM.","name":"Fix a VLOOKUP that fails on a space","url":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"mainEntity":[{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#/schema/question/1"}],"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Excel practice exercises","item":"https://practiceexcelonline.com/practice","position":2},{"@type":"ListItem","name":"VLOOKUP","item":"https://practiceexcelonline.com/practice/vlookup","position":3},{"@type":"ListItem","name":"Fix a VLOOKUP that fails on a space","position":4}]},{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"Why does VLOOKUP return","acceptedAnswer":{"@type":"Answer","text":"The two values are not exactly the same, most often because of a space at the end or a number stored as text. Wrap the lookup value in TRIM, =VLOOKUP(TRIM(F2),A2:C5,3,FALSE), and the space no longer matters."}},{"@id":"https://practiceexcelonline.com/practice/vlookup/vlookup-trim-spaces#/schema/learning-resource/1","@type":"LearningResource","description":"Practice fixing VLOOKUP #N/A in a live spreadsheet: remove an extra space from the lookup value with TRIM.","educationalLevel":"intermediate","isAccessibleForFree":false,"learningResourceType":"exercise","name":"Fix a VLOOKUP that fails on a space","teaches":"VLOOKUP"},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"}]}
```

## Sitemap

See the full [sitemap](https://practiceexcelonline.com/sitemap.md) for all pages.
