I'm essential building a table from the data in another table. Example:
Reference table
ColumnA | ColumB
coat | black, brown, red
hat | black, brown, green
pants | black, brown
shirt | red, blue, green
tie | brown, blue, green
New Table- Need cells in ColumnB to equal all things that match ColumnA
ColumnA | ColumB (Examples provided)
black | Example: coat, hat, pants
brown | Example: coat, hat, pants, tie
red | Example: coat, shirt
green | Example hat, shirt, tie
blue | Example: shirt, tie
Any ideas on how I can do this?
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.
Doing this will ensure you get the result you need!
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
PYR....attached a sample...
You can't use Lookups with empty columns in the data
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Are you looking for a "Native" or VBA Function (UDF) to do this ? (or sub routine for that matter)
Non-VBA would necessitate "helpers" (IMO) - in terms of scalable solution.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Well, I know there are things like vlookups and hlookups. I have tried vlookups but I've only been able to get it to return the last item matched...not all matching items.
The tables are not that large, maybe 100 or so line items. I think a native solution would be ideal, but I am open to anything that is easy and works.
OK - using your sample file and specifically Before Sheet
with the above in place we can generate the resultsF1 =INDEX($A:$A,2+(COLUMNS($F1:F1)-1)) copied across to say P1 F2: =IF(OR(F$1=0,$D2&$E2=""),"",REPT(F1,(ROWS(F$2:F2)<>1))&REPT(","&$D2,ISNUMBER(SEARCH(", "&F$1&",",", "&$E2&",")))) copied across matrix say F2:P10
If you then add additional colours per the Ref Table then the data should update automatically - eg:B2: =IF($B2="","",REPLACE(INDEX($F:$P,MATCH(REPT("Z",255),$D:$D),ROWS(B$2:B2)),1,1,"")) copied down to say B10
you should find the data (B2, B7) updates accordinglyA7: pink
D7: shoes
E7: black, pink
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thank you very much for the quick replies!!
I tried plugging in your suggestions...not sure if I did something wrong or not, but after populating F1:P1 and F2:P10 per your instructions I get an error:
"Cell references in the formula refer to the formula's result, creating a circular reference."
My attempt is attached in tmn_sample_2.xlsx. It looks like row 6 is the data I'm looking for (minus the leading ",") This is far closer then I've been able to get on my own![]()
Sorry typo on my part - B2 formula should begin with:
rather than=IF($A2=""
=IF($B2=""
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
SWEET!!!! Thank you very much!! Worked like a charm!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks