Vlookup Compare Values Between Columns - Ignore Spacing


I know the standard Vlookup comparison formula e.g.

=IF(ISNA(VLOOKUP(A1,$A$1:$A$15,1,FALSE)), "No", "Yes")

My query how do you make the standard formula ignore spacing.

Thank you.
ZackGeneral IT Goto GuyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Do you mean?

=IF(ISNA(VLOOKUP(TRIM(A1),$A$1:$A$15,1,FALSE)), "No", "Yes")

[ fanpages ]IT Services ConsultantCommented:

...or is "spacing" the space characters within text (rather than using TRIM that strips spaces from the beginning &/or the end of text)?

This formula needs to be entered within a cell as an array formula (using [CTRL]+[SHIFT]+[ENTER] instead of just [ENTER]):

=IF(ISNA(VLOOKUP(SUBSTITUTE(B1, " ", ""),SUBSTITUTE($A$1:$A$15," ", ""),1,FALSE)), "No", "Yes")

Note that I changed the first parameter from A1 to B1, as searching for A1 within A1:A15 will always return "Yes".

This approach will remove spaces from the beginning &/or end of the values as TRIM() does, but also will remove spaces from within values too.

For example,

"Hello World" is equivalent to "HelloWorld"
" Hello    World       " is also the same as "HelloWorld"



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
barry houdiniCommented:
Another approach to avoid "array entry" is to use SUMPRODUCT like this

=IF(SUMPRODUCT(0+(SUBSTITUTE(B1," ","")=SUBSTITUTE(A$1:A$15," ",""))),"Yes","No")

regards, barry
ZackGeneral IT Goto GuyAuthor Commented:
Cheers for the help.
[ fanpages ]IT Services ConsultantCommented:
You're very welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.