Highlight Adjacent Cells in a grid

JLEMS

New Member
Joined
May 27, 2020
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hi. I am new here and I have been trying to figure out how to get a spreadsheet to do what I need it to, but have not found the exact way to get it done. I have a 10X10 grid of random numbers. What I want to happen is I want a formula encompassing the entire grid, and highlight only the cells that are adjacent to each other if all 3 numbers are there. For example, I included a smaller scale image. I have a grid of numbers and only want the 312 to highlight, but only if the cells are adjacent to each other. I don't want it to highlight all the 3's 1's and 2's. Only if all 3 are there.

Think of it like a wordsearch puzzle. Does this make any sense and can anyone help?

Thanks
 

Attachments

  • 312.jpg
    312.jpg
    17.5 KB · Views: 9
That is almost right! Instead of the numbers being a set 1,2,3 the 3 digits will come from a reference of another cell. O3, O4, O5
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I am wanting to have the formula apply to B2:M13,C15:G21 and the reference to be O3,O4,O5
Untitled.jpg
 
Upvote 0
I am wanting to have the formula apply to B2:M13,C15:G21 and the reference to be O3,O4,O5
View attachment 14941
Cell Formulas
RangeFormula
B2:M13,C15:G21B2=RANDBETWEEN(0,9)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C15:G21Expression=OR(C15=$O$3,C15=$O$4,C15=$O$5)*COUNT(0/COUNTIF(OFFSET(C15,-1,-1,3,3),$O$3:$O$5))=3textNO
C15:G21Expression=(C15=$O$5)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$4)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$3),0))textNO
C15:G21Expression=(C15=$O$5)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$3)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$4),0))textNO
C15:G21Expression=(C15=$O$4)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$5)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$3),0))textNO
C15:G21Expression=(C15=$O$4)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$3)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$5),0))textNO
C15:G21Expression=(C15=$O$3)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$5)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$4),0))textNO
C15:G21Expression=(C15=$O$3)*OR(IFERROR((OFFSET(C15,-1,-1,3,3)=$O$4)*COUNTIF(OFFSET(C15,OR,OC,3,3),$O$5),0))textNO
B2:M13Expression=OR(B2=$O$3,B2=$O$4,B2=$O$5)*COUNT(0/COUNTIF(OFFSET(B2,-1,-1,3,3),$O$3:$O$5))=3textNO
B2:M13Expression=(B2=$O$5)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$4)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$3),0))textNO
B2:M13Expression=(B2=$O$5)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$3)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$4),0))textNO
B2:M13Expression=(B2=$O$4)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$5)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$3),0))textNO
B2:M13Expression=(B2=$O$4)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$3)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$5),0))textNO
B2:M13Expression=(B2=$O$3)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$5)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$4),0))textNO
B2:M13Expression=(B2=$O$3)*OR(IFERROR((OFFSET(B2,-1,-1,3,3)=$O$4)*COUNTIF(OFFSET(B2,OR,OC,3,3),$O$5),0))textNO
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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