Find the longest string of uncoloured cells

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
179
Office Version
  1. 2021
Platform
  1. Windows
Is it possible to create a formula to find the longest string of uncoloured cells?

The result I'm after are shown in Column AC and row 82. I've put the longest string in bold to show where they are.

Many thanks.




Suduko.xlsx
STUVWXYZAAABAC
6728242925-29263015-30173160-3162326033533483357936732
682828292830193163326333543486359336742
692831293030213168326433553488-3489359536753
702836-28382931302231693269335734923596-359736762
71283929323024-30253170-3172327033583496360036773
72284029333035-30363173327133593497360136793
732841293530383174327233613498360236804
742842293630403182-318432733362-33673499360336843
75284329373042-30433189327633693500-35011360536852
76284429383045-30463190327933703502360736864
77284529393048-30493194-3195328133733505361036885
782846294030503196328433743506361136894
792847-284829413051-30523198-3200328633843508-3510361236932
802850294230533201328733863512-3513361336944
81
82342243545
Hard
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You can't use formula's based on color. You will need VBA unless you can specify the condition for getting the green cells
 
Upvote 0
Well the condition is I've completed the problems (Suduko) in the green cells, the uncoloured cells have still to be solved. Is there something else I could use instead of colour to define those cells solved that could be used in a formula? Note: The sheet is obviously a lot bigger than the snippet I posted on here.
 
Upvote 0
Is there something else I could use instead of colour to define those cells solved that could be used in a formula?
Yes prefix/suffix the cells with a distinctive character. I have prefixed with "x"
(If you want them coloured as well you could use conditional formatting for that as I have done below. Then as you add the "x" prefix to additional cells they will automatically change to green and the "longest string" formulas will automatically update)

Marvo.xlsm
STUVWXYZAAABAC
672824x2925-2926x3015-3017x3160-316232603353x3483357936732
682828x292830193163x3263x3354x3486359336742
69283129303021x316832643355x3488-3489359536753
70x2836-28382931x302231693269x33573492x3596-3597x36762
712839x2932x3024-3025x3170-3172327033583496x360036773
72x28402933x3035-303631733271x33593497360136793
7328412935x3038x3174x327233613498360236804
74284229363040x3182-31843273x3362-336734993603x36843
75x28432937x3042-30433189x32763369x3500-35011360536852
762844x2938x3045-30463190327933703502x360736864
7728452939x3048-3049x3194-3195328133733505361036885
782846294030503196x3284x3374x3506361136894
79x2847-2848x2941x3051-3052x3198-320032863384x3508-3510361236932
802850294230533201x32873386x3512-3513x3613x36944
81
82342243545
Sheet1
Cell Formulas
RangeFormula
AC67:AC80AC67=MAX(FREQUENCY(IF(LEFT(S67:AA67,1)<>"x",COLUMN(S67:AA67)),IF(LEFT(S67:AA67,1)="x",COLUMN(S67:AA67))))
S82:AA82S82=MAX(FREQUENCY(IF(LEFT(S67:S80,1)<>"x",ROW(S67:S80)),IF(LEFT(S67:S80,1)="x",ROW(S67:S80))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S67:AA80Expression=LEFT(S67,1)="x"textNO
 
Last edited:
Upvote 0
Solution
Thank you very much Peter. I've amended that to include a ✔ on the right of each completed cell. Works a treat.
 
Upvote 0
You're welcome. Glad you could adapt it to something that suited you. Thanks for letting us know. (y)
 
Upvote 0
BTW, those formulas can be shortened a bit if your want. For my data format ..

Marvo.xlsm
STUVWXYZAAABAC
672824x2925-2926x3015-3017x3160-316232603353x3483357936732
682828x292830193163x3263x3354x3486359336742
69283129303021x316832643355x3488-3489359536753
70x2836-28382931x302231693269x33573492x3596-3597x36762
712839x2932x3024-3025x3170-3172327033583496x360036773
72x28402933x3035-303631733271x33593497360136793
7328412935x3038x3174x327233613498360236804
74284229363040x3182-31843273x3362-336734993603x36843
75x28432937x3042-30433189x32763369x3500-35011360536852
762844x2938x3045-30463190327933703502x360736864
7728452939x3048-3049x3194-3195328133733505361036885
782846294030503196x3284x3374x3506361136894
79x2847-2848x2941x3051-3052x3198-320032863384x3508-3510361236932
802850294230533201x32873386x3512-3513x3613x36944
81
82342243545
Sheet1
Cell Formulas
RangeFormula
AC67:AC80AC67=LET(d,S67:AA67,p,LEFT(d,1),c,COLUMN(d),MAX(FREQUENCY(IF(p<>"x",c),IF(p="x",c))))
S82:AA82S82=LET(d,S67:S80,p,LEFT(d,1),r,ROW(d),MAX(FREQUENCY(IF(p<>"x",r),IF(p="x",r))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S67:AA80Expression=LEFT(S67,1)="x"textNO
 
Upvote 0
Thanks again. I'm not really sure about the LET function operates but I can see how the first formula offered works so I'll stick with that. Cheers.
 
Upvote 0

Forum statistics

Threads
1,223,993
Messages
6,175,844
Members
452,675
Latest member
duongtruc1610

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