Age Group and Gender

pangs

New Member
Joined
Jan 9, 2019
Messages
4
Hi, I am having trouble sorting out this data, I need to sort it out according to the table and the value in the table should be counted as number "1".
In the first row, the column 4&5 was supposed to be merged but I can't do it here:confused: same with 6&7, 8&9.:biggrin:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]DATA[/TD]
[TD]DATA[/TD]
[TD]DATA[/TD]
[TD]Less than 1 year[/TD]
[TD][/TD]
[TD]1 to less than 2 years[/TD]
[TD][/TD]
[TD]2 to less than 5 years[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]GENDER[/TD]
[TD]AGE[/TD]
[TD]AGE GROUP[/TD]
[TD]MALE[/TD]
[TD]FEMALE[/TD]
[TD]MALE[/TD]
[TD]FEMALE[/TD]
[TD]MALE[/TD]
[TD]FEMALE[/TD]
[/TR]
[TR]
[TD]M[/TD]
[TD]1[/TD]
[TD]1 to less than 2 years[/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]5[/TD]
[TD]2 to less than 5 years[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]0[/TD]
[TD]less than 1 year[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]M[/TD]
[TD]3[/TD]
[TD]2 to less than 5 years[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]2[/TD]
[TD]2 to less than 5 years[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]M[/TD]
[TD]0[/TD]
[TD]less than 1 year[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]1[/TD]
[TD]1 to less than 2 years[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I copies your data to a new sheet starting in cell A1.

the following formula works with that data

Code:
=IF(OR(AND($A3="F",D$2="FEMALE"),AND($A3="M",D$2="MALE")),IF(ISERROR(IF(AND(ISNUMBER(LEFT(D$1,1)*1),AND($B3>=LEFT(D$1,1)*1,$B3<=MID(D$1,16,1)*1)),$B3,"")),IF(AND($B3<1,LEFT(D$1,1)="L"),$B3,""),IF(AND(ISNUMBER(LEFT(D$1,1)*1),AND($B3>=LEFT(D$1,1)*1,$B3<=MID(D$1,16,1)*1)),$B3,"")),"")
 
Upvote 0
Another option


Excel 2013/2016
ABCDEFGHI
1DATADATADATALess than 1 year1 to less than 2 years2 to less than 5 years
2GENDERAGEAGE GROUPMALEFEMALEMALEFEMALEMALEFEMALE
3M11 to less than 2 years  1   
4F52 to less than 5 years1
5F0less than 1 year1
6M32 to less than 5 years1
7F22 to less than 5 years1
8M0less than 1 year1
9F11 to less than 2 years1
Sheet1
Cell Formulas
RangeFormula
D3=IF(AND($C3=D$1,$A3=LEFT(D$2,1)),1,"")
E3=IF(AND($C3=D$1,$A3=LEFT(E$2,1)),1,"")
F3=IF(AND($C3=F$1,$A3=LEFT(F$2,1)),1,"")
G3=IF(AND($C3=F$1,$A3=LEFT(G$2,1)),1,"")
H3=IF(AND($C3=H$1,$A3=LEFT(H$2,1)),1,"")
I3=IF(AND($C3=H$1,$A3=LEFT(I$2,1)),1,"")
 
Upvote 0
Another option


Excel 2013/2016
ABCDEFGHI
1DATADATADATALess than 1 year1 to less than 2 years2 to less than 5 years
2GENDERAGEAGE GROUPMALEFEMALEMALEFEMALEMALEFEMALE
3M11 to less than 2 years  1   
4F52 to less than 5 years1
5F0less than 1 year1
6M32 to less than 5 years1
7F22 to less than 5 years1
8M0less than 1 year1
9F11 to less than 2 years1
Sheet1
Cell Formulas
RangeFormula
D3=IF(AND($C3=D$1,$A3=LEFT(D$2,1)),1,"")
E3=IF(AND($C3=D$1,$A3=LEFT(E$2,1)),1,"")
F3=IF(AND($C3=F$1,$A3=LEFT(F$2,1)),1,"")
G3=IF(AND($C3=F$1,$A3=LEFT(G$2,1)),1,"")
H3=IF(AND($C3=H$1,$A3=LEFT(H$2,1)),1,"")
I3=IF(AND($C3=H$1,$A3=LEFT(I$2,1)),1,"")

Man talking abut missing the obvious. I didn't even think to use the data in column C to match the headers D to H.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top