Calculate Age with vlookup to fill a text box

brendalpzm

Board Regular
Joined
Oct 3, 2022
Messages
59
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
Platform
  1. Windows
I have these activeX controls fields:
EmpNoBox = Employee Number (TextBox)
AgeBox = Final result with age (TextBox)
**These 2 are located in the "Registro" worksheet

In a different worksheet called "Base_Externos" I have a data base with the employees information, employee number is located in the A column and their birthdays on the C column, full range of data base is A:D.

I want the user to type their employee number and the AgeBox to be filled with their age by looking up their birthdates and comparing it with today date, this for the cases that the user clicks on their birthday so it should shouw up the age up to the present date. All this triggered by an activeX control button called SearchButton.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi,
For the Age formula in years-months-days, you can test following:

Excel Formula:
=DATEDIF(C2,TODAY(),"y")&" y "&DATEDIF(C2,TODAY(),"ym")&" m "&DATEDIF(C2,TODAY(),"md")&" d "
 
Upvote 0
Hi,
For the Age formula in years-months-days, you can test following:

Excel Formula:
=DATEDIF(C2,TODAY(),"y")&" y "&DATEDIF(C2,TODAY(),"ym")&" m "&DATEDIF(C2,TODAY(),"md")&" d "
Hi, But in this case I'm looking for a VBA solution
 
Upvote 0
OK ...
In VBA, you can use Evaluate("yourAgeFormula") to get your result
 
Upvote 1
Solution

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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