+ Reply to Thread
Results 1 to 17 of 17

Match multiple numbers in a Column against multiple strings and return a third Col value

  1. #1
    Registered User
    Join Date
    05-12-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Match multiple numbers in a Column against multiple strings and return a third Col value

    I'm trying to match/search the numbers in Col A:A (not in order) against the strings in B:B (in order) and if number exist, return the value in C:C. I'm trying to put this formula in column D.

    A: B: C: D:
    1 25489 Frank - 15655 - Stuff 145
    2 32587 Julia - 66556 - Plane 258
    3 22477 Jeff - 12555 - This 336
    4 Prieto - 25489 - That 325
    5 21486 - 2156
    6 12555 - 155
    7 15655 Jay - 32587 - Hey 2125
    8 66556 555555

    Example1: If number (15655 - A7) exist in any string in Col B (in this case it exist in B1 - Frank - 15655 - Stuff) return the value in Col C (in this case is 145)

    Example2: Number (12555 - A6) is in B3 (Jeff - 12555 - This ), return value in C3 (336), and so on.......

    Thanks in advance!!
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Perhaps:

    =IFERROR(LOOKUP(2,1/ISNUMBER(SEARCH(A1,$B$1:$B$8)),$C$1:$C$8),"")
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Or this one:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Produces different results in the last 5 rows.

    Edit:
    This takes care of the 0's in the last 5 rows of the above:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 07-17-2015 at 03:33 PM.
    Dave

  4. #4
    Registered User
    Join Date
    05-12-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    They both worked!!!!!! Now... Can I use the same formula if the values are in different workbooks? How about if I have multiple strings that contain the same number, in other words, multiple matches....?
    Last edited by elyoe011; 07-17-2015 at 04:34 PM.

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Probably, but could you upload a sample?

  6. #6
    Registered User
    Join Date
    05-12-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Different workbooks: I did it whit the following code:
    =IFERROR(LOOKUP(3, 2/ISNUMBER(SEARCH(B6, Report07172015.csv!$C$2:$C$485)), Report07172015.csv!$B$2:$B$485), "")

    Now... My questions is: What happens when it finds multiple strings that contains the same number?

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Try this variation:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    File is attached.

  8. #8
    Registered User
    Join Date
    05-12-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    That works too! But... What I really want to do is.... Like in your workbook (match-multiple-numbers-in-a-column-against-multiple-strings-and-return-a-third-col-value-match-multiple-numbers-in-a-column-against-multip.xlsx), since B2 (Julia - 66556 - Plane) and B15 (Julia - 66556 - Plane) numbers (66556) match. I would like to combine the result into one cell, for example: E2 would look like (258, 1776)

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Quote Originally Posted by elyoe011 View Post

    I would like to combine the result into one cell, for example: E2 would look like (258, 1776)
    OK. Then what would cells E12 and E15 look like?


    Edit: Answered my own question.
    Last edited by FlameRetired; 07-20-2015 at 06:27 PM.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    I used this formula for the first problem:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Will look at the second part.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    elyoe011,

    Concatenating two rows of output from the same column is going to take me some time to figure out. This could take me a while.

  12. #12
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    This might work. It combines daffodill11's formula with mine using helper columns:
    Find First occurrence enter in D2 and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Find last occurrence enter in E2 and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Enter in F2 and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Result:
    A
    B
    C
    D
    E
    F
    1
    First Last Combo
    2
    25489
    Frank - 15655 - Stuff
    145
    325
    325
    325
    3
    32587
    Julia - 66556 - Plane
    258
    2125
    2125
    2125
    4
    22477
    Jeff - 12555 - This
    336
    5
    33555
    Prieto - 25489 - That
    325
    6
    21486
    -
    2156
    7
    12555
    -
    155
    336
    336
    336
    8
    15655
    Jay - 32587 - Hey
    2125
    145
    7
    145, 7
    9
    66556
    1
    555555
    258
    6
    258, 6
    10
    Prieto - 2222 - That
    1
    7
    11
    Prieto - 2233656 - That
    2
    7
    12
    Prieto - 366 - That
    3
    7
    13
    Prieto - 5455 - That
    4
    7
    14
    Prieto - 566 - That
    5
    7
    15
    Julia - 66556 - Plane
    6
    7
    16
    Frank - 15655 - Stuff
    7
    7

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    I used a User Defined Function that circulates on the Forum call Concatall (see code below). It is written by tigeravatar. I used it wrapped around this array-entered formula in cell F1 in the attached and filled down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you aren’t familiar with array-entered formulas array enter means the formula must be committed by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.

    If you are not familiar with how to use UDFs copy the below code, in Excel open the VBA editor (Alt + F11), click on Edit in the menu and Insert Module. Then paste this code into that module.

    By the way: The formula above does not include the Personal.xlsb! prefix to Concatall that the upload has. That is because I store my UDFs / macros in that macro file. If you do not store yours in that file you’ll need to delete that prefix from formula in the upload. I did not include the UDF in this file. I am a bit squeamish about downloading .xlsm files. I suspect others are, too.

    Please Login or Register  to view this content.
    Does this do what you want?

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    BTW:

    The file output (column F) looks like this next to the old. I added another row of data to columns B and C to test this.

    Row\Col
    A
    B
    C
    D
    E
    F
    1
    25489
    Frank - 15655 - Stuff
    145
    145
    145
    2
    32587
    Julia - 66556 - Plane
    258
    258
    258, 1776
    3
    22477
    Jeff - 12555 - This
    336
    336
    336, 2001
    4
    33555
    Prieto - 25489 - That
    325
    325
    0, 325
    5
    21486
    -
    2156
    155, 2156
    6
    12555
    -
    155
    155
    7
    15655
    Jay - 32587 - Hey
    2125
    2125
    2125
    8
    66556
    1
    555555
    555555
    9
    Prieto - 2222 - That 0
    10
    Prieto - 2233656 - That 0
    11
    Prieto - 366 - That 0
    12
    Prieto - 25489 - That
    0
    0
    13
    Prieto - 5455 - That 0
    14
    Prieto - 566 - That 0
    15
    Julia - 66556 - Plane
    1776
    1776
    1776
    16
    Jeff - 12555 - This
    2001
    2001
    2001

  15. #15
    Registered User
    Join Date
    05-12-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Newdoverman, FlameRetired - Thanks al lot for taking the time to work on this matter..... Both of your suggestions worked great!!! I really appreciate your time a collaboration. elyoe011

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Thanks for the feedback. It makes it worthwhile knowing that you have a solution that works for you.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

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

    Re: Match multiple numbers in a Column against multiple strings and return a third Col val

    Echo newdoverman.

+ 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. Multiple Criteria Index/Match Function in VBA Looking Up Dates/Strings/Numbers
    By nadstradamus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2014, 12:35 PM
  2. MATCH using Multiple Criteria and Return the Row Numbers
    By biosonik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2013, 02:56 PM
  3. excel formula to search Multiple strings in several columns and return strings
    By krratna123 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-13-2013, 11:20 AM
  4. Replies: 1
    Last Post: 08-13-2013, 08:32 AM
  5. Match multiple repeating strings in a column and output the row number
    By anilsen0711 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-02-2013, 09:12 AM
  6. Replies: 3
    Last Post: 06-06-2012, 01:44 PM
  7. Replies: 2
    Last Post: 06-29-2011, 01:36 PM
  8. MATCH *similar* strings and return adjacent column value
    By mzerega in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-22-2009, 07:36 PM

Tags for this Thread

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