+ Reply to Thread
Results 1 to 11 of 11

Checking if one or more numbers in a cell can be found in the cell to the right

  1. #1
    Registered User
    Join Date
    01-24-2019
    Location
    Lagos, Nigeria
    MS-Off Ver
    Microsoft Excel 2013
    Posts
    15

    Checking if one or more numbers in a cell can be found in the cell to the right

    Good Afternoon.

    I have two cells in excel side by side containing numbers. I want a true response in the third cell (column) if one or more numbers in the first cell can be found in the second cell and a false response if none of the numbers in the first cell appear in the second cell.


    Example
    01234 278 TRUE
    1356 5689 TRUE
    37 56 FALSE



    Thank you.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    With VBA, but it an probably be done with formulas as well.

    Please Login or Register  to view this content.
    Last edited by JLGWhiz; 01-24-2019 at 03:30 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    01-24-2019
    Location
    Lagos, Nigeria
    MS-Off Ver
    Microsoft Excel 2013
    Posts
    15
    Thank you JLGWhiz. The VBA code works perfectly.
    Last edited by Timicheckmate; 01-24-2019 at 04:16 PM.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    removed, only worked on your examples, when I tried a different last number it failed.
    Last edited by Sam Capricci; 01-24-2019 at 04:23 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    Quote Originally Posted by Timicheckmate View Post
    Thank you JLGWhiz. The VBA code works perfectly.
    You're welcome, Don't forget to make the thread as Solved.
    Regards, JLG
    Last edited by JLGWhiz; 01-24-2019 at 08:22 PM.

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    Here's a formula based solution. It assumes the 2 numbers are in A1 and B1. Enter this formula in C1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This, I think, works for all numbers in A1 with 9 digits or less.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    Another one.

    With source data in columns A and B try array entering this formula in C1 and fill down.

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    A
    B
    C
    1
    01234
    278
    TRUE
    2
    1356
    5689
    TRUE
    3
    37
    56
    FALSE
    Dave

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    Another one.
    C1 Press Ctrl+Shift+Enter

    =COUNT(FIND(MID(B1,ROW(INDIRECT("1:"&LEN(B1))),1),A1))>0

  9. #9
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    @ Bo, @FlameRetired - are you sure about your solutions? Example:

    A1 = 1374, B1 = 278

    These numbers have "7" in common so the formula should return TRUE as far as I can see from the OP's requirements. I think you are both generating FALSE. I get TRUE as does JLGWhiz's VBA solution.

    ---------------------------------------------------------------------------
    EDIT: never mind - I missed the fact you both have array formulas. Everything works fine!

    Full marks to Bo in particular for another elegant solution.
    Last edited by GeoffW283; 01-25-2019 at 01:01 AM.

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    Thank, Geoff

    My formula is combined your and Dave's formula. I just add COUNT as it counts only numbers and ignores error.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Checking if one or more numbers in a cell can be found in the cell to the right

    @ GeoffW283

    Full marks to Bo in particular for another elegant solution.
    I concur.

+ 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] delete cell if found number 1 duplicates for 5 times (11111) or more between numbers
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2018, 10:35 PM
  2. [SOLVED] Checking that a cell contains 4letters then 7 numbers
    By ReganK in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-27-2018, 04:07 PM
  3. [SOLVED] Checking that a cell contains 4 numbers followed by 7 numbers
    By ReganK in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-08-2018, 05:10 PM
  4. [SOLVED] IF/AND Formula in a cell, cross checking other cells then displaying them in another cell
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 03-27-2017, 10:06 AM
  5. Replies: 7
    Last Post: 02-27-2014, 10:56 PM
  6. Replies: 1
    Last Post: 09-11-2013, 12:12 AM
  7. Replies: 2
    Last Post: 10-12-2012, 11:38 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