translating excel formula into
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

replyReply Wed 16 Jun 2010, 15:46Delegate Pasquale said...

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?

For upcoming training course dates see: Pricing & availability

replyReply Thu 17 Jun 2010, 13:32Trainer Simon said...

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

 

Please browse our web site to find out more about
2002 access online training and other Microsoft training courses.

Access tip:

Create own ribbon tab - Access 2010

a. In Access click on the File tab
b. Select Options from left hand side
c. Choose the Customize Ribbon section
d. Click the New Tab button (below the list of tabs on the right hand side of the dialog box)
e. Select the New Tab (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
f. Select the New Group (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
g. Add commands to your tab and group by locating them on the list on the right hand side (remembering that you can change the list using the drop down box at the top of the list of commands) and clicking the Add button between the two panes to add them to your tab and group
h. You can rearrange the commands in your group, the groups on any tab or the tabs, using the up and down arrow buttons beside the list of tabs.
i. Click OK to apply your changes

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard