Calculate Age Using DATEDIF Function

Written by kazamraza no comments

Excel Formula


=DATEDIF(A2, TODAY(), "y") &" years, "&DATEDIF(A2, TODAY(), "ym") &" months, " &DATEDIF(A2, TODAY(), "md") &" days"

 

 

Example
A B C D E
1 Data Formula Result    
2 06-Jun-90 =DATEDIF(A2, TODAY(), "y") &" years, "&DATEDIF(A2, TODAY(), "ym") &" months, " &DATEDIF(A2, TODAY(), "md") &" days" 30 years, 0 months, 17 days    
3          
4          

 

Note: Today date is assumed as 23/Jun/2020.

Macro To Insert And Rename Multiple Sheet

Written by kazamraza no comments

VBA Code


Sub addsheet()

Dim newsheet

Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "HO"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Area1"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Niaz Baig"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Chung"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Bhola Garhi"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Shahpur"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Ali Razabad"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Area2"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Maraka"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Halloki"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Shamki Bhatian"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Manga"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Raiwind"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Area3"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Begumkot"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Dhamkey"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Sharqpur"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Rachna Town"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Muridkey"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Area4"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Phool Nagar"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Jhumber"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Pattoki"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Chunian"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Habibabad"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Area5"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Nankana"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Shahkot"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Bucheki"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "Warburton"
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    newsheet.Name = "More Khunda"
End Sub