+ Reply to Thread
Results 1 to 8 of 8

Selection of rows by matching with multiple values of a field in a different table

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Selection of rows by matching with multiple values of a field in a different table

    Dear All,

    This is my problem:

    1)I have a table with these fields (columns):
    - id
    - ideas_id
    - boxes_id
    - status

    2)and another table with these fields (columns):
    - id
    - name
    - description

    the field "boxes_id" in the first table has the same meaning of the field "id" in the second box; but in the second table I have less values;

    what I want to get is:
    a new table with the same fields of table 1;
    the condition that a row of table 1 has to verify to be part of the resultant table is: the value of "boxes_id" has to match any value of "id" in table 2; I don't want to specify a value of "id", I want to consider all the different "id" values in table 2 in the check condition.

    I hope to have made me clear. I am not sure!

    Thank you very much for the help!!
    Mirco.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Selection of rows by matching with multiple values of a field in a different tabl

    mircoexcel87,

    Welcome to the forum!
    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Selection of rows by matching with multiple values of a field in a different tabl

    One way (of several, I'm sure) is to have a helper column in the first sheet of =IF(COUNTIF(Sheet2!A:A,C2),Max(E$1:E1)+1,""). (I assumed this would be in E2 with headers in row 1). Drag down the length of the column.

    In your third table, assuming it's on Sheet3 with headers, A2 can have =Index(Sheet1!A:A,Match(Rows(A$2:A2),Sheet1!$E:$E,0)). You should then be able to drag that across and down as needed.
    Life is about perseverance. Remember: today's mighty oak tree is just yesterday's nut that held its ground.

    If you like a post, please rate it with the scales icon (top right).
    If you feel really indebted, please consider a donation to charity, such as Feed the Children or Habitat for Humanity.

  4. #4
    Registered User
    Join Date
    12-01-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Selection of rows by matching with multiple values of a field in a different tabl

    As soon as I will be able to try it, I will let you know the result.

    Thank you very much!

  5. #5
    Registered User
    Join Date
    12-01-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Exclamation Re: Selection of rows by matching with multiple values of a field in a different tabl

    I have tryed, but Excel tells me that the typed formula has an error and it select the bolded part of the formula:

    =IF(COUNTIF(Sheet2!A:A,C2),Max(E$1:E1)+1,"")

    Thank you very much!

    Mirco.

  6. #6
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Selection of rows by matching with multiple values of a field in a different tabl

    It's possible you may need to change commas to semicolons in the formula, depending on your version.

    On a related noted, could you please update your location to something more meaningful? Knowing your country will help us help you with such issues as this, as well as date and time issues. Thanks.

  7. #7
    Registered User
    Join Date
    12-01-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Re: Selection of rows by matching with multiple values of a field in a different tabl

    Sorry!

    Now I should have updated the information: I am an Italian student studing in Sweden.

    About the formula, I have changed the commas with semicolons: Excel doesn't say me anymore that there is an error,
    but when I insert the formula, the classic window to open a file shows on the screen and the header of this window is: (it is my translation from Italian, I don't know if it is the same in the english version)
    "Update values: Sheet2"

    Is it normal?

    Which file do I have to select?

    Sorry for the questions, I am not really in Excel.

    Thank you very much!

  8. #8
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Selection of rows by matching with multiple values of a field in a different tabl

    Any chance you could post an example workbook? I don't think I've seen that error before.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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