Check if certain combinations are present in certain columns

BGerm

New Member
Joined
Feb 5, 2020
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
I want to check if these combinatios are present in an excel sheet for each Father, Mother and their Child. If they are highlight them, or bold, or in an empty column, in same row, write error.
Each Mother,Father, Child separated by an empy column are separate case.

I am beginner in VBA, thank you for suggestions in advance.

My data looks like this
childmotherfatherchildmotherfatherchildmotherfather
ChrStartEndRefAlt
1​
2​
3​
4​
5​
6​
8​
9​
10​
malefemalemalefemalefemalemalemalefemalemale
1​
3775283​
3775283​
TG1/1/1/1/0/01/1/1/1/0/00/00/00/0
1​
3782273​
3782273​
CA1/1/0/00/00/00/00/00/00/00/0
1​
3782307​
3782307​
CG0/00/00/01/1/NaN0/00/10/01/1/
1​
3782524​
3782524​
CT0/10/01/1/0/00/00/01/1/0/00/0
1​
3782550​
3782550​
CT0/00/00/0NaN1/1/0/00/00/00/0
1​
3784600​
3784600​
CTNaN1/1/0/00/00/00/01/1/1/1/0/0
1​
3786165​
3786165​
CT0/00/00/00/10/01/1/0/00/00/0
1​
3786185​
3786185​
CT0/00/00/00/00/00/0NaN1/1/0/0
1​
3786189​
3786189​
GA1/1/1/1/0/11/1/1/1/0/10/00/10/1
1​
3786228​
3786228​
CT0/00/00/00/00/00/00/00/00/0
1​
3786245​
3786245​
GA1/1/NaN0/01/1/0/00/01/1/NaN0/0
1​
3786275​
3786275​
AG0/00/00/00/00/00/01/1/0/00/0
1​
3789026​
3789026​
TG1/1/NaN0/01/1/NaN0/00/00/00/0
1​
3789061​
3789061​
TCNaN1/1/0/00/00/00/00/00/00/0

For these combinations I am checking:

FatherMotherChild
0/00/01/1/
0/00/00/1
0/00/11/1/
0/01/1/1/1/
0/01/1/0/0
0/10/01/1/
0/11/1/0/0
1/1/0/00/0
1/1/0/01/1/
1/1/0/10/0
1/1/1/1/0/1
1/1/1/1/0/0
NaN0/01/1/
NaN1/1/0/0
0/0NaN1/1/
1/1/NaN0/0
 

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.
Hi,

Welcome to the Board!

Is the following what you want:
Book1
ABCDEFGHIJKLMNOPQ
1childmotherfatherchildmotherfatherchildmotherfather
2ChrStartEndRefAlt1234568910
3malefemalemalefemalefemalemalemalefemalemale
4
5
6137752833775283TG1/1/1/1/0/01/1/1/1/0/00/00/00/0
7137822733782273CA1/1/0/00/00/00/00/00/00/00/0
8137823073782307CG0/00/00/01/1/NaN0/00/10/01/1/
9137825243782524CT0/10/01/1/0/00/00/01/1/0/00/0
10137825503782550CT0/00/00/0NaN1/1/0/00/00/00/0
11137846003784600CTNaN1/1/0/00/00/00/01/1/1/1/0/0
12137861653786165CT0/00/00/00/10/01/1/0/00/00/0
13137861853786185CT0/00/00/00/00/00/0NaN1/1/0/0
14137861893786189GA1/1/1/1/0/11/1/1/1/0/10/00/10/1
15137862283786228CT0/00/00/00/00/00/00/00/00/0
16137862453786245GA1/1/NaN0/01/1/0/00/01/1/NaN0/0
17137862753786275AG0/00/00/00/00/00/01/1/0/00/0
18137890263789026TG1/1/NaN0/01/1/NaN0/00/00/00/0
19137890613789061TCNaN1/1/0/00/00/00/00/00/00/0
20
21
22FatherMotherChild
230/00/01/1/
240/00/00/1
250/00/11/1/
260/01/1/1/1/
270/01/1/0/0
280/10/01/1/
290/11/1/0/0
301/1/0/00/0
311/1/0/01/1/
321/1/0/10/0
331/1/1/1/0/1
341/1/1/1/0/0
35NaN0/01/1/
36NaN1/1/0/0
370/0NaN1/1/
381/1/NaN0/0
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O6:Q19Expression=COUNTIFS($A$23:$A$38;O6;$B$23:$B$38;P6;$C$23:$C$38;Q6)>0textNO
K6:M19Expression=COUNTIFS($A$23:$A$38;K6;$B$23:$B$38;L6;$C$23:$C$38;M6)>0textNO
G6:I19Expression=COUNTIFS($A$23:$A$38;G6;$B$23:$B$38;H6;$C$23:$C$38;I6)>0textNO
 
Upvote 0
My data frame is much bigger than one I posted here, so I do not know is it hand to write for 245 trio such formatting, if I got your approach right.
 
Upvote 0
OK. I have now applied the same conditional formatting to all cells in the area and it works precisely the same way. So you can enter it for all 245 families(?) in one step or make for just one cell (I did it for G6) and then use format painter to apply it to all of them in one step.

Book1
ABCDEFGHIJKLMNOPQ
1childmotherfatherchildmotherfatherchildmotherfather
2ChrStartEndRefAlt1234568910
3malefemalemalefemalefemalemalemalefemalemale
4
5
6137752833775283TG1/1/1/1/0/01/1/1/1/0/00/00/00/0
7137822733782273CA1/1/0/00/00/00/00/00/00/00/0
8137823073782307CG0/00/00/01/1/NaN0/00/10/01/1/
9137825243782524CT0/10/01/1/0/00/00/01/1/0/00/0
10137825503782550CT0/00/00/0NaN1/1/0/00/00/00/0
11137846003784600CTNaN1/1/0/00/00/00/01/1/1/1/0/0
12137861653786165CT0/00/00/00/10/01/1/0/00/00/0
13137861853786185CT0/00/00/00/00/00/0NaN1/1/0/0
14137861893786189GA1/1/1/1/0/11/1/1/1/0/10/00/10/1
15137862283786228CT0/00/00/00/00/00/00/00/00/0
16137862453786245GA1/1/NaN0/01/1/0/00/01/1/NaN0/0
17137862753786275AG0/00/00/00/00/00/01/1/0/00/0
18137890263789026TG1/1/NaN0/01/1/NaN0/00/00/00/0
19137890613789061TCNaN1/1/0/00/00/00/00/00/00/0
20
21
22FatherMotherChild
230/00/01/1/
240/00/00/1
250/00/11/1/
260/01/1/1/1/
270/01/1/0/0
280/10/01/1/
290/11/1/0/0
301/1/0/00/0
311/1/0/01/1/
321/1/0/10/0
331/1/1/1/0/1
341/1/1/1/0/0
35NaN0/01/1/
36NaN1/1/0/0
370/0NaN1/1/
381/1/NaN0/0
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G6:Q19Expression=COUNTIFS($A$23:$A$38;G6;$B$23:$B$38;H6;$C$23:$C$38;I6)>0textNO
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

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