473,542 Members | 2,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Max of Two Numbers in SQL - What function is available?

1 New Member
I am trying to figure out a way to find the max of two numbers in access, and then multiply whatever the max is by 0.008.
For example:
2019 Sales - $9,634.33
2020 Sales - $3,466.37
Find the max of the two and multiply by 0.008.

Hopefully I am explaining this well. The 2019 and 2020 sales differ for each company, so not everyone's 2020 sales will be greater than their 2019 and vice versa.
Dec 22 '20 #1
1 1729
NeoPa
32,562 Recognized Expert Moderator MVP
Hi there.

Are you calculating this from within a query or from VBA?

Either way you can use the IIf() function but illustrating it changes based on your usage.

Query (SQL) :
Expand|Select|Wrap|Line Numbers
  1. IIf([2019 Sales]>[2020 Sales],[2019 Sales],[2020 Sales])*0.008
VBA :
Expand|Select|Wrap|Line Numbers
  1. X = IIf(dbl2019Sales > dbl2020Sales, dbl2019Sales, dbl2020Sales)*0.008
Dec 22 '20 #2

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

Similar topics

9
10418
by: Rowan Chapman | last post by:
Hey all! I'm kinda new to VB but not to programin'. So I know what it is like when you are asked trivial questions. Could some1 please tell me what the syntax would be 2 only allow numerical data into a textbox. thankz in advanced -Ro -------------------------------------------------------------------- " Reality is an illusion caused by...
10
5928
by: Ken VdB | last post by:
Hi everyone, Is there a reason why the Mid() function only works in one direction in VBScript? This code works in VB6 but not in VBScript? Is there a way around it? I am trying to create an ASP page which produces a fixed width text file for import into a third party legacy application which I don't have control over. --code sample--...
1
1280
by: Yannick Warnier | last post by:
Hi there, I'd like to know since what version the md5() function is available in postgresql. I didn't find the function in the doc (I tried looking at some of the different function types in the user doc). Also, how may I find it by myself? Is there a complete list of function names and description somewhere? Thanks,
0
964
by: Raymond L. Buvel | last post by:
Due to the contribution of Frank Palazzolo, a Windows binary installer and build instructions are available for the clnum package. This also makes ratfun and rpncalc usable on the Windows platform. The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. It also provides...
7
3933
by: Greg | last post by:
Visual Studio - Line numbers missing from error list I'm writing an app in ASP.NET using VS 2005. There are no line numbers with the build errors reported. Any suggestions? I can't find any reports of anyone else having the same problem. Is there a setting I may have missed? Greg.
14
2900
by: nishit.gupta | last post by:
Is their any single fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" , It can also contain zero
7
2584
by: Anz | last post by:
Can any one know the javascript function to auto resize the swf when resizing its pop up window. I need to auto resize the swf when i resize my popup window in which the swf is displayed. Is there any javascript function available to perform this requirement ?
5
3868
by: Jock | last post by:
My purchase order system sequentially added the next number to the new order when I clicked the macro button set up with copy/paste functions and it worked well. I cannot do this now as 2007 does not offer these macro functions. My system simply looked at the last record copied the number in the field - opened a new record and pasted the...
1
1726
by: kalees waran | last post by:
is it possible function available to use multiple headers in a page
2
6917
by: mvjohn100 | last post by:
Does anyone know if there is a UUDecode function available to JavaScript john
0
7392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7670
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
943
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.