age wise group data sort

majidsiddique

Board Regular
Joined
Oct 22, 2018
Messages
164
Hi all,

tell me how i can values in group wise below mention table.

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl64, width: 64"]Person[/TD]
[TD="class: xl64, width: 64"]Age[/TD]
[/TR]
[TR]
[TD="class: xl63"]majid[/TD]
[TD="class: xl63"]19[/TD]
[/TR]
[TR]
[TD="class: xl63"]sajid[/TD]
[TD="class: xl63"]25[/TD]
[/TR]
[TR]
[TD="class: xl63"]khalid[/TD]
[TD="class: xl63"]20[/TD]
[/TR]
[TR]
[TD="class: xl63"]ahmed[/TD]
[TD="class: xl63"]60[/TD]
[/TR]
[TR]
[TD="class: xl63"]nasir[/TD]
[TD="class: xl63"]35[/TD]
[/TR]
[TR]
[TD="class: xl63"]khan[/TD]
[TD="class: xl63"]45[/TD]
[/TR]
[TR]
[TD="class: xl63"]gulraz[/TD]
[TD="class: xl63"]31[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 512"]
<colgroup><col width="64" span="8" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]
Age-G[/TD]
[TD="class: xl65, width: 64"]majid[/TD]
[TD="class: xl65, width: 64"]sajid[/TD]
[TD="class: xl65, width: 64"]khalid[/TD]
[TD="class: xl65, width: 64"]ahmed[/TD]
[TD="class: xl65, width: 64"]nasir[/TD]
[TD="class: xl65, width: 64"]khan[/TD]
[TD="class: xl65, width: 64"]gulraz[/TD]
[/TR]
[TR]
[TD="class: xl66"]15-29[/TD]
[TD="class: xl65"]19[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]30-44[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]45-60[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
</tbody>[/TABLE]


for example Majid age is 45 appear in age group 45-60. i try this but failed. can anybody help me?

=IF(G$2=VLOOKUP(G$2,$A$2:$A$8,1,0),IF(AND($B2>=15,$B2<=29),$B2,"--"))
this formula never complete solution when trag it in column wise, fail.

trag it all 19 value paste in column wise.

thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Assuming your Person / Age table is A1:B8 and the table you want to fill in is A10:H13 then this formula in B11 and dragged should work for you;

Code:
=IF(AND(VLOOKUP(B$10,$A$2:$B$8,2,FALSE)>=VALUE(LEFT($A11,2)),VLOOKUP(B$10,$A$2:$B$8,2,FALSE)<=VALUE(RIGHT($A11,2))),VLOOKUP(B$10,$A$2:$B$8,2,FALSE),"")
 
Upvote 0
If your lookup table is in A2:B8 and the Age Group table in A13:H16 you can try something like:

=IF(AND(VLOOKUP(B$13,$A$2:$B$8,2,0)>=--LEFT($A14,2),VLOOKUP(B$13,$A$2:$B$8,2,0)<=--RIGHT($A14,2)),VLOOKUP(B$13,$A$2:$B$8,2,0),"")

This should work as long as both the min and max of each age group have 2 digits (= between 10 and 99). Otherwise you should replace the fixed length of two characters with a SEARCH of FIND function that locates the "-" from your age groups. Or if you want to get away real easy try having both max and min values of each age groups in helper columns ( = No need for double negatives or any other extra calculations).
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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