+ Reply to Thread
Results 1 to 12 of 12

Two numbers as text not equal...why?

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Two numbers as text not equal...why?

    I have a vlookup I must do, and I convert all the codes to text simply because some are numbers and some are letter/number combos. Can someone please explain why in the attached file when I converted these numbers to text from two different sources they don't equal despite being the exact same? Obviously one sees itself as formerly being a number and the other, which came from a CSV file, does not.

    I've tried to paste as values, I've checked the lengths with the length function, I'm stumped. Again, I'd just keep them as numbers but unfortunately some of the codes have letter designations with them.

    Two Unequal Numbers.xlsx

    Thanks!

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Two numbers as text not equal...why?

    Hi,

    Not sure how you went about converting them to text, but the value in B1 is still a number.

    What method did you employ?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Two numbers as text not equal...why?

    Because they are text and not numbers

    Try it like this

    =--A1=B1
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Two numbers as text not equal...why?

    They have to be text AlKey because as I mentioned sometimes they will have a letter (G or AG) attached to them. Your method doesn't work when I attached a G to the end.

    Xor, I tried to paste as values (which probably made them back into numbers huh?) I also tried changing the format at the top to text. What do you suggest? I have to save as text or a "string" because of the mix of letters and numbers, but this was so straightforward it confused me.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Two numbers as text not equal...why?

    If you Paste Special/Values a number into a cell which has been pre-formatted as text then the resulting entry will be a number formatted as text, as desired.

    Regards

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Two numbers as text not equal...why?

    another way...

    =EXACT(A1,B1)

  7. #7
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Two numbers as text not equal...why?

    Xor, I tried that (turned the format of two cells to text than pasted as values), and it did not work. You can try in the file I sent and you will see.

    Ok AlKey that was helpful in getting them to match. Now how does this translate to a Vlookup? How do I get the Vlookup to see them as "Exact".

    Thanks.

  8. #8
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Two numbers as text not equal...why?

    Index/Match causes the same issue - I added an example where it worked fine from the same sheet: How can I force it (explicitly) to text as the number correctly seen as text is stating. Probably just a silly issue. Once these match exactly, I can do a vlookup, index/match, etc.

    Two Unequal Numbersv2.xlsx

  9. #9
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Two numbers as text not equal...why?

    Please find the attached sheet to see if this is what you are trying to achieve.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  10. #10
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Two numbers as text not equal...why?

    Thanks Sktneer, but as I mentioned when XOR did the same thing above, I cannot convert it to a number like you did because sometimes it will have a letter in the name. I want to use text because it could be a number, it could be letters, or it could be a mix of both.

    Let's say I have 1174505 and 1174505G. Can't I just convert these to text and look them up? Why can't 1174505 and 1174505G all be converted (I think called "explicit type" in programming languages) to text and then a look made on them? If this was the name Sktneer, I could look that up, why can't I fool excel into thinking 1174505 is a "string as well"?

    Quote Originally Posted by sktneer View Post
    Please find the attached sheet to see if this is what you are trying to achieve.

  11. #11
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Two numbers as text not equal...why?

    Quote Originally Posted by Vaslo View Post
    Thanks Sktneer, but as I mentioned when XOR did the same thing above, I cannot convert it to a number like you did because sometimes it will have a letter in the name. I want to use text because it could be a number, it could be letters, or it could be a mix of both.

    Let's say I have 1174505 and 1174505G. Can't I just convert these to text and look them up? Why can't 1174505 and 1174505G all be converted (I think called "explicit type" in programming languages) to text and then a look made on them? If this was the name Sktneer, I could look that up, why can't I fool excel into thinking 1174505 is a "string as well"?
    Sktneer, I didn't see case 2 - that may work as a solution if nothing more native in the application comes along. That's a sharp idea to append with the "" to force the text. I just don't understand why copying and pasting it to a text formatted box like XOR suggested doesn't work. I'm missing something silly here, probably easy fix. Thanks.

  12. #12
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Two numbers as text not equal...why?

    I think you should provide a workbook with enough sample data in it with the desired output.
    BTW see if the following method helps you.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sort column with equal numbers and linked text
    By keis386 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-08-2014, 06:52 AM
  2. How to make cell values equal certain text depending on other cells' text
    By Wes Borland in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2013, 02:08 PM
  3. Replies: 3
    Last Post: 12-12-2012, 12:30 PM
  4. Locate two equal numbers in an array of numbers
    By avveerkar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2010, 01:22 AM
  5. [SOLVED] want to remove all text characters equal to one character in length from text string
    By tinalwalton@yahoo.co.uk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-18-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1