Pre filter data or add custom value with a query within another query?

dreid1011

Well-known Member
Joined
Jun 4, 2015
Messages
3,614
Office Version
  1. 365
Platform
  1. Windows
I have tried to look this up a little bit already, but I don't think I can word it properly to find what I am looking for. Anyways, this is what I would like to know:

Is it possible, through a calculated field or sub query, to add a value to query results based on a specific value in each record?

Ex: I would like to run a query on our database to return all properties in an area. Each property has a specific tax code assigned, which can be used to determine if the property is within city limits or without. What I would like to be able to do is use a sub query within my main query to analyze the tax code for each property and then assign one of two values to a new field that would display with the main query results.

Sure, I could do this in excel with a custom formula or some VBA, but it would be much more convenient if I could do it at the time of export. Is this possible? Maybe even some VBA in access that could be called when I need it?

Thank you!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Have a table with the tax code and your value, then link to that table.
Use a DlookUp() on same table (will be slower)
Use and IIF() function if simple calculation, else create your own function if complicated.
 
Upvote 0
Ah, yes, a new table with just the tax codes and the values I want to see is a much simpler solution than I was making it out to be. No lookups or functions required. Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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