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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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
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
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
Also, show us your SQL. This will help to determine the issue.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,144
Members
448,552
Latest member
WORKINGWITHNOLEADER

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