Find the wrong value

janu319

New Member
Joined
Feb 11, 2021
Messages
3
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: 5

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
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?
 

janu319

New Member
Joined
Feb 11, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
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","")
 
Solution

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,573
Messages
5,637,135
Members
416,959
Latest member
Mohzein

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