translating excel formula into

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Translating an Excel formula into an Access expression

Translating an Excel formula into an Access expression

resolvedResolved · High Priority · Version 2003

Pasquale has attended:
Access Introduction course
Access Intermediate course
Access Advanced course

Translating an Excel formula into an Access expression

Hello,

I've got a spreadsheet that contains a list of birth dates of several people on a database I manage. In the cases where I don't have a date of birth, the date is listed as "unknown." I need to calculate all ages (as an integer value) and have come up with the following formula in Excel to do that:

=IF((AND(F4="unknown")),"unknown", (INT((TODAY()-F4)/365.25)))

How do I translate that formula into an Access expression that can be run as a query?

RE: Translating an Excel formula into an Access expression

Hi Pasquale,

Thank you for your question.

This formula should do the trick:

age: IIf([DateOfBirth]="Unknown","Unknown",DateDiff("yyyy",[DateOfBirth],Date()))

Create a query add the fields you need and then add a new field by using the expression builder and copy the formula above into the box and change the field as necessary.

I hope this helps.

Regards

Simon


 

Access tip:

Insert The Current Time

To insert the current time into a Table field or Form textbox use:

Ctrl+Colon(:)

View all Access hints and tips


Server loaded in 0.09 secs.