+ Reply to Thread
Results 1 to 12 of 12

Compare two cells if contain same number

  1. #1
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Compare two cells if contain same number

    Hi all.
    I have the A2 cell with this string: IB 1234. It can be IB1234 or ib 1234, BR 1234, or whatever combination, etc..
    I want to check if the A2 cell contains the samen number, and only number, as the cell A3, an return a Yes/NO in A4.
    Example:
    A2 B2 C2
    IB1234 IB 1234 YES (it contains same number)
    BR 1234. BR 1234. YES (it contains same number)
    ib1234. IB 1234. YES (it contains same number)

    Spanish formula if possible. I attach a workbook for that. Thanks
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    Hi -

    Try =IF(RIGHT(A2,4)=RIGHT(B2,4),"YES","NO") then copy down.

  3. #3
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Re: Compare two cells if contain same number

    Can you send me an example in a sheet? In spanish language the formula is diferent and gives me an error. Trying to translate and same.
    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    Sure. Will it always have the numbers just at the end? If so the RIGHT function looks at the value at the end and goes back x spaces (4 in your case).

    =IF(RIGHT(A2,4)=RIGHT(B2,4),"YES","NO")
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Re: Compare two cells if contain same number

    It works, thanks!
    But now I see the problem. The number no check with B cells can be in any A cell, A range... any way for this?.
    C2 is the YES NO, comparing B2 with all A range.
    sorry...

  6. #6
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    I just put the formula in D, meant to put it in C ---- sorry.

    So B2 will always be the same and you want to compare B2 with anything in Column A?

  7. #7
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Re: Compare two cells if contain same number

    Exactly, yes. B2 will be the number to check, and A will be the range to search. C2 will be the result: YES if the number in B2 is in A range and NO if it's no.
    thanks

  8. #8
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    Just put a $ in front of the B and the 2 in the formula then. Leave the first part of the formula as is.

    =IF(RIGHT(A2,4)=RIGHT($B$2,4),"YES","NO")

    So when you copy the formula down into other cells, A2 becomes A3 and A4, etc. But the B2 will always stay B2

  9. #9
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Re: Compare two cells if contain same number

    But this does not check the entry A range, only A2.
    Thanks for your help.

  10. #10
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    See my updated file to explain.

    The formula in C2 looks at A2 and B2.
    When you copy the formula down to C3, it will look at A3 and B2.
    When you copy the formula down to C4, it will look at A4 and B2, etc
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-02-2016
    Location
    Espaņa
    MS-Off Ver
    2013
    Posts
    50

    Re: Compare two cells if contain same number

    Sorry I think I don't undertand you.
    I send you another wbook with explanation.
    Thanks again for your help.
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Compare two cells if contain same number

    OK - I see what you're trying to do now. Unfortunately, don't think there is an easy formula to do that.

+ 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. Replies: 4
    Last Post: 04-15-2020, 04:48 PM
  2. [SOLVED] Compare two cells and pick up the common number..help and thanks.
    By NEW2006 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-20-2013, 10:18 AM
  3. Replies: 5
    Last Post: 09-22-2012, 09:53 AM
  4. Replies: 6
    Last Post: 05-30-2012, 03:09 PM
  5. [SOLVED] Compare columns, replace matching number with reference number and fill down random amount
    By datadigger in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-04-2012, 10:53 PM
  6. Replies: 4
    Last Post: 06-12-2010, 01:10 PM
  7. [SOLVED] How do I compare cells and if FALSE compare to next cell in EXCEL
    By Cindie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-24-2006, 01:35 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