Query for finding errors in input

udigold1

New Member
Joined
Dec 15, 2008
Messages
45
Hi, I'm pretty novice in query design,
I'm trying to figure out how to get a query that returns me error in data input, by that I mean the following (for example):
I Have a table with the fields "Car maker", "Car model", "Car plate number" and "Car color".
Basically the Car model should hold a code that also represent the color of it, but Car Color is independently selected, so I could have mistakes.
meaning that if for car plate number 11-22-33 which is model SZK (K for black), the color Blue was selected by mistake.

I want a query that will return me every discrepancy between car model and car color. ( I mean that if there's one SZK blue and one SZK that is black, I want both to appear in the query)

Thanks in advance!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
You will need a table that shows each model, and then what color that model should be.
Then, you can link this table to your other table on the model field, and return records where the color from the main data table does not match the color from the model/color table.
 
Upvote 0
Create a query that extract the model and color fields only, and group them, so that it weeds out all duplicates.

Then create a new query based on that first query, that has the same two fields, but groups on the model field, and counts the color field.
If you set this query to only return records where the color count is greater than one, it will list out all the models that have discrepancies.

If you want to then see all the colors in the discrepancies, you can link the two queries together based on the model field, and return the model and color fields.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,046
Members
449,063
Latest member
ak94

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