Query Help Please

nancybrown

Well-known Member
Joined
Apr 7, 2005
Messages
868
In my query, I am using a table called 2008 Vendors, and 2009 Vendors; each has a payment term field.

I've added an extra column called "Updated Terms." Can someone tell me how to write a query that would the 2008 against the 2009 fields and to return one of the 3 results (I'd like to avoid SQL if possible):

If 2008 payment terms = 2009 payment terms "No Change"
If 2008 payment terms < 2009 payment terms "Updated"
If 2008 payment terms > 2009 payment terms "blank"

Thank you in advance.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Will_B

Board Regular
Joined
Mar 4, 2009
Messages
79
In your query, add a new column and paste this where the field name would go:

My_Results: IIF([2008 payment terms] = [2009 payment terms], "No Change",IIF([2008 payment terms] < [2009 payment terms],"Update","blank"))

This formula uses the "immediate if statement" (IIF), nesting one within the other. The translation is: Criteria, do this if true, do this if false. In the formula I gave you, the "do this if false" is to perform another IIF test.

"blank" is the result if the = and < tests fail; it doesn't have an explicit > test.
 
Upvote 0

nancybrown

Well-known Member
Joined
Apr 7, 2005
Messages
868
Hi, thank you, I tried it and it gave me a dialog box to enter data, naturally, I didn't enter any so it returned "" values.
 
Upvote 0

nancybrown

Well-known Member
Joined
Apr 7, 2005
Messages
868
Sorry it took so long to respond, yes, one field is called 2008 Payment Terms, and the other is called 2009 Payment Terms.
 
Upvote 0

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
7,475
Office Version
  1. 365
Platform
  1. Windows
Also, show us your SQL. This will help to determine the issue.
 
Upvote 0

Forum statistics

Threads
1,190,677
Messages
5,982,216
Members
439,769
Latest member
trungminh2802

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
Top