---
title: "Fix a VLOOKUP that fails on a space in Google Sheets | PracticeExcel"
description: "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."
canonical_url: "https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces"
meta:
  "og:description": "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."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Fix%2Ba%2BVLOOKUP%2Bthat%2Bfails%2Bon%2Ba%2Bspace%2Bin%2BGoogle%2BSheets%2Cdescription_~VGhlIGNvZGUgaW4gRjIgd2FzIHBhc3RlZCBmcm9tIGFuIGVtYWlsIGFuZCBlbmRzIHdpdGggYSBzcGFjZSwgc28gYSBwbGFpbiBWTE9PS1VQIHJldHVybnMgI04vQS4gSW4gRzIsIGxvb2sgdXAgdGhlIHByaWNlIHdpdGggVFJJTShGMikgYXMgdGhlIGxvb2t1cCB2YWx1ZS4%2Ceyebrow_VLOOKUP%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRyJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJDb2RlIiwiUHJvZHVjdCIsIlByaWNlIiwiUHJpY2UiXX0seyJuIjoyLCJjZWxscyI6WyJBMTAiLCJQZW4iLCIxMiIsIiJdfSx7Im4iOjMsImNlbGxzIjpbIkIyMCIsIk5vdGVib29rIiwiMzUiLCIiXX0seyJuIjo0LCJjZWxscyI6WyJDMzAiLCJTdGFwbGVyIiwiODkiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJENDAiLCJGb2xkZXIiLCIyNCIsIiJdfV0sInRhcmdldCI6WzEsM119fQ%2Cp_Ii9zaGVldHMvcHJhY3RpY2Uvdmxvb2t1cC92bG9va3VwLXRyaW0tc3BhY2VzIg%2Cs_T4jzZbrrMedQwTzz.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Fix a VLOOKUP that fails on a space in Google Sheets | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Fix%2Ba%2BVLOOKUP%2Bthat%2Bfails%2Bon%2Ba%2Bspace%2Bin%2BGoogle%2BSheets%2Cdescription_~VGhlIGNvZGUgaW4gRjIgd2FzIHBhc3RlZCBmcm9tIGFuIGVtYWlsIGFuZCBlbmRzIHdpdGggYSBzcGFjZSwgc28gYSBwbGFpbiBWTE9PS1VQIHJldHVybnMgI04vQS4gSW4gRzIsIGxvb2sgdXAgdGhlIHByaWNlIHdpdGggVFJJTShGMikgYXMgdGhlIGxvb2t1cCB2YWx1ZS4%2Ceyebrow_VLOOKUP%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRyJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJDb2RlIiwiUHJvZHVjdCIsIlByaWNlIiwiUHJpY2UiXX0seyJuIjoyLCJjZWxscyI6WyJBMTAiLCJQZW4iLCIxMiIsIiJdfSx7Im4iOjMsImNlbGxzIjpbIkIyMCIsIk5vdGVib29rIiwiMzUiLCIiXX0seyJuIjo0LCJjZWxscyI6WyJDMzAiLCJTdGFwbGVyIiwiODkiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJENDAiLCJGb2xkZXIiLCIyNCIsIiJdfV0sInRhcmdldCI6WzEsM119fQ%2Cp_Ii9zaGVldHMvcHJhY3RpY2Uvdmxvb2t1cC92bG9va3VwLXRyaW0tc3BhY2VzIg%2Cs_T4jzZbrrMedQwTzz.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**

**Your first month for $9.50 **~~$19~~

50% off your first month when you join today.

[**Get your first month for $9.50**](https://practiceexcelonline.com/signup?next=/pricing?plan=monthly%26go=1%26offer=FIRSTMONTH)

Then $19/month. Cancel any time, and get a full refund within 14 days if it isn't for you.

[**See all plans, from $5/month**](https://practiceexcelonline.com/pricing)

[**Already premium? Sign in**](https://practiceexcelonline.com/login?next=/sheets/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://excelpraxis.de/#website"}]},{"@id":"https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces#webpage","@type":"WebPage","description":"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.","name":"Fix a VLOOKUP that fails on a space in Google Sheets","url":"https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces","breadcrumb":{"@id":"https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Google Sheets practice exercises","item":"https://practiceexcelonline.com/sheets","position":2},{"@type":"ListItem","name":"VLOOKUP","item":"https://practiceexcelonline.com/sheets/practice/vlookup","position":3},{"@type":"ListItem","name":"Fix a VLOOKUP that fails on a space in Google Sheets","position":4}]},{"@id":"https://practiceexcelonline.com/sheets/practice/vlookup/vlookup-trim-spaces#/schema/learning-resource/1","@type":"LearningResource","description":"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.","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.
