Hello,
I am having some difficulty wrapping my head around this.
I know I can get a rough solution via pivot tables but I would like to explore the vba route as well.
I am looking for a macro that would take the following table from sheet1
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Name[/TD]
[TD]hair[/TD]
[TD]nose[/TD]
[TD]eyes[/TD]
[TD]ears[/TD]
[/TR]
[TR]
[TD]Donald[/TD]
[TD]high[/TD]
[TD]medium[/TD]
[TD]low[/TD]
[TD]na[/TD]
[/TR]
[TR]
[TD]Trump[/TD]
[TD]low[/TD]
[TD]na[/TD]
[TD]medium[/TD]
[TD]high[/TD]
[/TR]
</tbody>[/TABLE]
Where:
- High = red filled cell
- Medium = yellow filled cell
- Low = green filled cell
- na = no fill
And do the following
1) Transpose the data in another sheet, called sheet2
2) Instead of taking the "high/medium/low/na", the macro take the column headings such as "hair, nose, eyes, ears" and posts it beside the name
3) For the column in sheet2 that includes the column headings from sheet1, the column in sheet2 should say the headings in sheet1, by matching the color fill of the category.
eg. Hair - Donald, will have a red filled cell for "Hair" as it falls under "high" which is a red filled cell in sheet1.
eg. Eyes - Trump, will have a yellow filled cell for "Eyes" as it falls under "medium" which is a yellow filled cell in sheet 1.
The "solution" would look something like this
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Category[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]hair (red fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]nose (yellow fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]eyes ( green fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]hair (green fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD]eyes (yellow fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD]ears (red fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Note there's no Ears for Donald or Nose for Trump as they are both "na" and should not show up on sheet 2.
From what I saw, there's a lot of ways I can transpose, but I can't seem to find a transposition which takes the column headings instead of the data under the column headings while also omitting the data under the column headings (and omitting certain columns all together eg. if "na").
Any help is greatly appreciated.
I am having some difficulty wrapping my head around this.
I know I can get a rough solution via pivot tables but I would like to explore the vba route as well.
I am looking for a macro that would take the following table from sheet1
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Name[/TD]
[TD]hair[/TD]
[TD]nose[/TD]
[TD]eyes[/TD]
[TD]ears[/TD]
[/TR]
[TR]
[TD]Donald[/TD]
[TD]high[/TD]
[TD]medium[/TD]
[TD]low[/TD]
[TD]na[/TD]
[/TR]
[TR]
[TD]Trump[/TD]
[TD]low[/TD]
[TD]na[/TD]
[TD]medium[/TD]
[TD]high[/TD]
[/TR]
</tbody>[/TABLE]
Where:
- High = red filled cell
- Medium = yellow filled cell
- Low = green filled cell
- na = no fill
And do the following
1) Transpose the data in another sheet, called sheet2
2) Instead of taking the "high/medium/low/na", the macro take the column headings such as "hair, nose, eyes, ears" and posts it beside the name
3) For the column in sheet2 that includes the column headings from sheet1, the column in sheet2 should say the headings in sheet1, by matching the color fill of the category.
eg. Hair - Donald, will have a red filled cell for "Hair" as it falls under "high" which is a red filled cell in sheet1.
eg. Eyes - Trump, will have a yellow filled cell for "Eyes" as it falls under "medium" which is a yellow filled cell in sheet 1.
The "solution" would look something like this
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Category[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]hair (red fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]nose (yellow fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]eyes ( green fill)[/TD]
[TD]Donald[/TD]
[/TR]
[TR]
[TD]hair (green fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD]eyes (yellow fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD]ears (red fill)[/TD]
[TD]Trump[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Note there's no Ears for Donald or Nose for Trump as they are both "na" and should not show up on sheet 2.
From what I saw, there's a lot of ways I can transpose, but I can't seem to find a transposition which takes the column headings instead of the data under the column headings while also omitting the data under the column headings (and omitting certain columns all together eg. if "na").
Any help is greatly appreciated.