简体   繁体   中英

Determine if there is a space in a cell in Excel

I have aa spreadsheet with over 2000 lines that each have a unique reference number. I want to use the reference numbers to VLOOKUP to another report. my problem is that while all reference numbers have a letter at the end, some have a space between the letter and the numbers while others do not have a space in-between.

For example: 637408 A compared to 837408A

The sheet I want to use a VLOOKUP to compare the references with does not have a space between the letter and the numbers. Is there an Excel function that I can use to quickly detect which references have a space, and if they do, eliminate the space? Thank You.

To remove all spaces in, say, column A , try this short macro:

Sub SpaceKiller()
    Range("A:A").Replace What:=" ", replacement:=""
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM