Convert Excel Formula To Access

bwlytkr

Board Regular
Joined
Jun 8, 2012
Messages
173
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,213,510
Messages
6,114,048
Members
448,543
Latest member
MartinLarkin

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