Formula help

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,446
Office Version
  1. 2007
Platform
  1. Windows
I need couple formulas that would return ( 1 ) when they find :

11111 or 2111 or 221 or 311 or 32 or 41 or 5

Those digits could be in different order !!!



<table style="font-family:Arial,Arial; font-size:10pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; " border="1" cellpadding="0" cellspacing="0"> <colgroup><col style="font-weight:bold; width:30px; "><col style="width:26px;"><col style="width:26px;"><col style="width:26px;"><col style="width:26px;"><col style="width:26px;"><col style="width:26px;"><col style="width:19px;"><col style="width:42px;"><col style="width:42px;"><col style="width:42px;"><col style="width:42px;"><col style="width:42px;"><col style="width:42px;"><col style="width:42px;"></colgroup><tbody><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td> </td><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td><td>F</td><td>G</td><td>H</td><td>I</td><td>J</td><td>K</td><td>L</td><td>M</td><td>N</td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">11111</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">2111</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">221</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">311</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">32</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">41</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">5</td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">2</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">3</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">4</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">5</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">3</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td> </td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">6</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">7</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">8</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">9</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">5</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">10</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">11</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">12</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">3</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">2</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td> </td><td> </td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">13</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">4</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td style="text-align:center; ">1</td><td> </td></tr><tr style="height:17px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">14</td><td style="background-color:#ffffcc; text-align:center; ">0</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td style="background-color:#ffffcc; text-align:center; ">1</td><td> </td><td style="text-align:center; ">1</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr></tbody></table>
Thank you.


Excel tables to the web >>
Excel Jeanie HTML 4
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Here is a method with names.
Select H3 and define these names

Name: Aremoved RefersTo: =SUBSTITUTE(Sheet1!H$1,Sheet1!$A3,"",1)
Name: Bremoved RefersTo: =SUBSTITUTE(Aremoved,Sheet1!$B3,"",1)
Name: Cremoved RefersTo: =SUBSTITUTE(Bremoved,Sheet1!$C3,"",1)
Name: Dremoved RefersTo: =SUBSTITUTE(Cremoved,Sheet1!$D3,"",1)
Name: Eremoved RefersTo: =SUBSTITUTE(Dremoved,Sheet1!$E3,"",1)
Name: Fremoved RefersTo: =SUBSTITUTE(Eremoved,Sheet1!$F3,"",1)

Then put the formula
=IF(Fremoved="", 1, "") in H3 and drag down and right.

Or you could combine them all into a monster formula.
 
Upvote 0
Thank you Mike for responding, but I don't understand your method !!
I'm not an expert like you with Excel, and if the formula is to complicated I will try to organize my file in a different way.

Thank you.
 
Upvote 0
Mike's idea does seem a good one. The same idea could also be done directly with a formula, which may appeal to the OP if Mike's Names implementation is too difficult.

Formula in H3 copied down and across.

Excel Workbook
ABCDEFGHIJKLMN
111111211122131132415
2
3120011 1
40210021
50310101
61101021
70021021
80022011
90050001
101100121
112110011
120300201
131000401
140111111
Combos 2





If the values in H1, I1, J1 , ... each have their digits arranged from largest to smallest, as they are with the sample data, then this approach may also be suitable.

Formula in G3 copied down.
Formula in H3 copied down and across.

Excel Workbook
ABCDEFGHIJKLMN
111111211122131132415
2
3120011211100 1
40210022210001
50310103110001
61101022111001
70021022210001
80022012210001
90050005000001
101100122111001
112110012111001
120300203200001
131000404100001
140111111111101
Combos 3





I do have a question:
Would it be possible to have in row 1 '221' and '21'?
If so, all the methods suggested so far would return a '1' in both those columns for the sample data in A3:F3. Would that be the correct results?
 
Last edited:
Upvote 0
Mike and Peter,

You are both incredible, you did a marvelous job with those formulas, that help me a lot in my work.

Thank you so much for the help.

Serge.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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