![]() |
Matching column criteria in a one to many relationship
I need to create a formula or function that evaluates criteria from 5 (B-F)
columns and matches it to another 5 (G-K) columns. If all the columns are equal (combination of text and numbers) then a site identifier in Column A needs to be copied and pasted to another column (L). Here is where it gets fun- Each site identifier in Column A (e.g. S1, S2, S3 etc) which is described by Columns B-F can relate to many individual records in Column G-K. In other words there are many more records in columns G-K about 5 times more. So the formula will have to look through a range of information in B-F to find a match. Essentially the B-F data represents a site location- "Watershed Basin Code", "Stream Code", "River Name", "River Mile" and "Year". These same column headings are in G-K but relate to separate species information. Thus you can have 20 species at one site- so the formula would potentially to recognize that there are 20 S1's and maybe only 5 S2's etc. There are instances where certain sites do not have bio data and vice versa. I imagine it will have to be a long complicated formula in which I am stumbling to find a foundation. Thank you for your time and consideration JB |
Matching column criteria in a one to many relationship
JB
If I understand what you want, a formula is not going to do it. You will need VBA. Let me rephrase what you said but in generic language. You have entries in Column A. Starting in what row? You have entries in Columns B:F in the same rows as the entries in Column A. You have entries in Columns G:K. Starting in what row? The entries in G:K are not necessarily related to the entries in B:F in the same rows. You want Excel to loop through all the rows of the entries in B:F. For EACH row of B:F, you want Excel to loop through ALL the entries in G:K for a match in ALL 5 columns of B:F and G:K If a match is found, you want the entry in Column A copied to Column L. In what row? Is this right? Can there be more than one match? If so, where do you want the Column A entry copied? HTH Otto "JB Akron" wrote in message ... I need to create a formula or function that evaluates criteria from 5 (B-F) columns and matches it to another 5 (G-K) columns. If all the columns are equal (combination of text and numbers) then a site identifier in Column A needs to be copied and pasted to another column (L). Here is where it gets fun- Each site identifier in Column A (e.g. S1, S2, S3 etc) which is described by Columns B-F can relate to many individual records in Column G-K. In other words there are many more records in columns G-K about 5 times more. So the formula will have to look through a range of information in B-F to find a match. Essentially the B-F data represents a site location- "Watershed Basin Code", "Stream Code", "River Name", "River Mile" and "Year". These same column headings are in G-K but relate to separate species information. Thus you can have 20 species at one site- so the formula would potentially to recognize that there are 20 S1's and maybe only 5 S2's etc. There are instances where certain sites do not have bio data and vice versa. I imagine it will have to be a long complicated formula in which I am stumbling to find a foundation. Thank you for your time and consideration JB |
Matching column criteria in a one to many relationship
|
Matching column criteria in a one to many relationship
One other thought ...
Assuming data in row2 down Put this in L2, normal ENTER: =INDEX(A$2:A$10,MATCH(1,INDEX((B$2:B$10=G2)*(C$2:C $10=H2)*(D$2:D$10=I2)*(E$2:E$10=J2)*(F$2:F$10=K2), ),0)) Copy down as far as required, to return desired results from col A. Adapt the ranges (cols A to F ranges) to suit your actuals. -- Max Singapore http://savefile.com/projects/236895 Downloads:22,500 Files:370 Subscribers:66 xdemechanik --- "JB Akron" wrote: I need to create a formula or function that evaluates criteria from 5 (B-F) columns and matches it to another 5 (G-K) columns. If all the columns are equal (combination of text and numbers) then a site identifier in Column A needs to be copied and pasted to another column (L). Here is where it gets fun- Each site identifier in Column A (e.g. S1, S2, S3 etc) which is described by Columns B-F can relate to many individual records in Column G-K. In other words there are many more records in columns G-K about 5 times more. So the formula will have to look through a range of information in B-F to find a match. Essentially the B-F data represents a site location- "Watershed Basin Code", "Stream Code", "River Name", "River Mile" and "Year". These same column headings are in G-K but relate to separate species information. Thus you can have 20 species at one site- so the formula would potentially to recognize that there are 20 S1's and maybe only 5 S2's etc. There are instances where certain sites do not have bio data and vice versa. I imagine it will have to be a long complicated formula in which I am stumbling to find a foundation. Thank you for your time and consideration JB |
Matching column criteria in a one to many relationship
I put in the suggestion from Max below but was returned an N/A#.
Think it should have worked ok. Probably data inconsistency or extra white spaces somewhere is throwing correct matching off. Can you upload your sample file using a free filehost, then post a link to it here? You can use this "easy-to-use" free filehost to upload: http://www.freefilehosting.net/ Copy the "direct link" which is generated after you upload, then paste it here in your reply (desensitize the data in your sample as required) -- Max Singapore http://savefile.com/projects/236895 Downloads:22,500 Files:370 Subscribers:66 xdemechanik --- |
Matching column criteria in a one to many relationship
Here is the link it should be easier to see now. Thank you very much.
http://freefilehosting.net/download/445i5 "Max" wrote: I put in the suggestion from Max below but was returned an N/A#. Think it should have worked ok. Probably data inconsistency or extra white spaces somewhere is throwing correct matching off. Can you upload your sample file using a free filehost, then post a link to it here? You can use this "easy-to-use" free filehost to upload: http://www.freefilehosting.net/ Copy the "direct link" which is generated after you upload, then paste it here in your reply (desensitize the data in your sample as required) -- Max Singapore http://savefile.com/projects/236895 Downloads:22,500 Files:370 Subscribers:66 xdemechanik --- |
Matching column criteria in a one to many relationship
Your prob was data inconsistency. The data in col K were text nums, whilst
that in the corresponding col F were real nums. To convert col K all at one go to real nums for consistent matching, just copy any empty cell, then select col K, right-click paste special check "Add" ok. That should do it, and you'd get the results you seek. Pl press the YES button below. -- Max Singapore http://savefile.com/projects/236895 Downloads:22,500 Files:370 Subscribers:66 xdemechanik --- "JB Akron" wrote: Here is the link it should be easier to see now. Thank you very much. http://freefilehosting.net/download/445i5 |
Matching column criteria in a one to many relationship
Another way to coerce the text nums to real nums
is simply to add a zero to col K's values in the expression, ie amend it to: ...*(F$2:F$24=K2+0) then copy the expression down. -- Max Singapore http://savefile.com/projects/236895 Downloads:22,500 Files:370 Subscribers:66 xdemechanik --- |
All times are GMT +1. The time now is 11:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com