473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert Excel Formula to access

Hi All,

I have a formula used in Excel that I am trying to convert for use in a query. the original formula is:

=IF(D2>=45;IF((INT(B2/60)-1)<=0;0;INT(B2/60)-1);INT(B2/60))

Thank you.
Feb 22 '14 #1
2 1494
zmbd
5,501 Expert Mod 4TB
You don't state the version of Office/Access/Excel nor the context of usage so the question is difficult the to answer with certainty - nor can we even attempt to provide an example of SQL, for you without such information, that amounts to anything more than a best guess.

However, in Access, you have the use if IIF() or SWITCH() in a query SQL.
Personally, I would look at the SWITCH() Function rather than nested IIF() conditionals as it is usually a cleaner and easier to maintain approach.

An Access example would be:

Expand|Select|Wrap|Line Numbers
  1. SELECT Switch(TablePK=1,"Result1",TablePK=2,"Result2",TablePK=15,"Result3") AS Expr1
  2. FROM tbl_example
Feb 22 '14 #2
ADezii
8,834 Expert 8TB
Assuming a Table named Table1 with Fields [B2]{LONG} and [D2]{LONG}, and a Calculated Field named [Outcome], the equivalent Formulation would be:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.B2, 
  2. Table1.D2, IIf([D2]>=45,IIf((Int([B2]/60)-1)<=0,0,Int([B2]/60)-1),Int([B2]/60)) AS Outcome
  3. FROM Table1;
  4.  
Feb 22 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: alphaomega3 | last post by:
I have a formula used in Excel that I am trying to convert for use in a query. the original formula is: ...
3
by: skiddle | last post by:
I've got an Excel formula that calculates the total business hours that a help desk ticket is open. As one would expect, it factors out holidays and non-work hours. What would be the corresponding...
2
by: welshkaiboy | last post by:
Due to the size of the data I have to manipulate I need to apply a excel formula in access which determines date of manufacture from a serial number 716001 so I use...
2
by: rtilson | last post by:
I am not sure why excel and access use the same method in formula. I am not access expert but been trying to figure it out. Here is the excel formula that I would like to use in access expression...
0
by: Lina Arraiz | last post by:
I'm trying to export an Excel 2003 spreadsheet to Access 2007. I need to calculate the time elapsed between column D (START) and column E (END) with the results appearing in column F (TIME). The...
3
by: david sherman | last post by:
Does software converting excel to access with financial functions exist? I need to take several fixed income portfolio run manually from excel and create a database. The excel relies heavily on...
2
by: Geraldpauig | last post by:
Hi there, need help in converting the excel fomulas to ms access. =IF(C2<=0,IF(SUM(B$2:B3)<F$2,0,SUM(B:B)-F$2),"") below is the data from query1 and query2 QUERY1 COLUMN A ...
21
by: Sabrina Smith | last post by:
I am not a programmer - so I don't know code, however, I do need some help if anyone can oblige me... I have a project that requires me to add 4 workdays (excluding holidays) to a beginning date...
10
by: Cayetano | last post by:
I created a table that has a field name InTime and a field name OutTime with a calculated field name TotalTime. Now I need to create a calculated field name TotalUnits. I need to convert the excel...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.