Assign a number value to a Date in Excel

samwong

New Member
Joined
Dec 14, 2017
Messages
1
Hi

How should I use IF or IFS function to deal with the situation below. Many thanks!

I would to assign the number "1" for the age group of 1960s, "2" for the 1970s and "3" for the 1980s.

Current data:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Age Group[/TD]
[/TR]
[TR]
[TD]1/1/1960[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31/12/1969[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/1970[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31/12/1979[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/1980[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31/12/1989[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Proposed result:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Age Group[/TD]
[/TR]
[TR]
[TD]1/1/1960[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]31/12/1969[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]1/1/1970[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]31/12/1979[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]1/1/1980[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]31/12/1989[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
2 formula alternatives that you can try.
Copy or fill the formulas down.


Excel 2010
ABCDEF
120-Dec-5200
220-Dec-621100
320-Dec-70221-Jan-601
431-Dec-89331-Jan-702
514-Dec-17001-Jan-803
61-Jan-900
7
2c
Cell Formulas
RangeFormula
B1=LOOKUP(A1,$E$2:$F$6)
C1=IF(A1>=32874,0,IF(A1>=29221,3,IF(A1>=25569,2,IF(A1>=21916,1,0))))
A5=TODAY()
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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