Find the wrong value

janu319

New Member
Joined
Feb 11, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi, can someone please help me with this query.
As shown in the attached image, for one room in one house, if the code is 100 or 101, then the other rooms in that house should not have a code 102.
I want to get those values and highlighted in the sheet.

House NumberNu.RoomsCode
11100
21101
22102Wrong
2A1102
2A2102
2A3102
2A4102
31103
41102Wrong
42101
43102Wrong
44100
45103
51102
61101

Thanks in advance,
Janu
 

Attachments

  • codes.PNG
    codes.PNG
    12.8 KB · Views: 7

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I am not sure I follow your logic/example.
If the following is really true:
for one room in one house, if the code is 100 or 101, then the other rooms in that house should not have a code 102.
then shouldn't ALL of the entries for House Number 4 be marked as "Wrong" instead of just a few?
 
Upvote 0
I am not sure I follow your logic/example.
If the following is really true:

then shouldn't ALL of the entries for House Number 4 be marked as "Wrong" instead of just a few?
Thanks for your reply.
As the room 2 in House number 4 has code 101, the other rooms in house number 4 should not have code 102, any other codes like 100 or 103 are possible.
 
Upvote 0
OK, I see now.

Put this formula in cell D2 and copy down for all rows:
Excel Formula:
=IF(AND(C2=102,OR(COUNTIFS(A:A,A2,C:C,100)>0,COUNTIFS(A:A,A2,C:C,101)>0)),"Wrong","")
 
Upvote 0
Solution

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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