Why does this work?

  • Thread starter Thread starter M Thompson
  • Start date Start date
M

M Thompson

I got this formula from Max, Singapore: =VLOOKUP((A1&B1)+0,Sheet2!A1:C6,3,0)
I would like to know how the +0 is working in this. I've spent about alot of
time in Help and on the internet trying to find out, but I think you guys are
the ones that can clear it up. I know it's making the formala recognize the
concatenation as a number, but how?
Thanks and have...
 
=A1&B1
concatenates two strings.

So if A1 contained 1 and B1 contained 23, the
=A1&B1
would result in the string 123

By adding 0 to the string, excel will coerce the string value to a real number
123.

If you put
=A1&B1
in C1
and
=(A1&B1)+0
in D1

You can see the difference with formulas like:
=isnumber(c1)
=isnumber(d1)
and
=istext(c1)
=istext(d1)
 
Just to add to Dave's reply, any mathematical operation on a piece of text
that can be interpreted as numeric, will coerce it to a numeric.

Same answer can be obtained with:

=VLOOKUP((A1&B1)+0,Sheet2!A1:C6,3,0)
=VLOOKUP((A1&B1)*1,Sheet2!A1:C6,3,0)
=VLOOKUP(--(A1&B1),Sheet2!A1:C6,3,0)

Regards
Ken..................
 
Just to add to Dave's reply, any mathematical operation on a piece of text
that can be interpreted as numeric, will coerce it to a numeric.

Same answer can be obtained with:

=VLOOKUP((A1&B1)+0,Sheet2!A1:C6,3,0)
=VLOOKUP((A1&B1)*1,Sheet2!A1:C6,3,0)
=VLOOKUP(--(A1&B1),Sheet2!A1:C6,3,0)

Regards
Ken..................
 
Hi Dave
Thanks for the explanation. It will be a definite help for the future.
P.S. This is the second try at replying to your answer. I keep getting a
temporarily out of service notice, so let's hope you get this one!

Have..
 
Hi Dave
Thanks for the explanation. It will be a definite help for the future.
P.S. This is the second try at replying to your answer. I keep getting a
temporarily out of service notice, so let's hope you get this one!

Have..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top