Convert Excel Formula To Access

bwlytkr

Board Regular
Joined
Jun 8, 2012
Messages
185
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am trying to convert an excel formula in access but don't have the knowledge to do so. Is there a way to convert this excel formula to run with my access query? This is what I am using in Excel. =IF(S2<1825,"< 5 Years Old",IF(AND(S2>1824),"> 5 Tears Old")). The Access database name is Raw_NJUNS and Column "S" is NTG Interval. I tried several things but, keep getting errors. Any help would be appreciated. Thanks.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I got it to work by using this formula in case anyone needs this in the future


<>5YRS_OLD: IIf([NTG INTERVAL]<=1825,"< 5yrs",IIf([NTG INTERVAL]>1825,"> 5yrs"
 
Upvote 0
I guess you could also try:
<>5YRS_OLD: IIf([NTG INTERVAL]<=1825,"< 5yrs","> 5yrs")
 
Upvote 0
Similar with your Excel formula the second IF and the AND function are not required. If can return one value if true and another if false. IF,Then,Else.

Code:
=IF(S2>1825,">","<")&" 5 Years Old"
 
Upvote 0
Similar with your Excel formula the second IF and the AND function are not required. If can return one value if true and another if false. IF,Then,Else.
Note that Access does NOT have an "IF" function. It has an "IIF" function.
Access VBA has a IF...THEN function that works similarly to Excel's VBA equivalent.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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