I am trying to add exceptions to a formula

rmbmst1972

New Member
Joined
Sep 29, 2018
Messages
14
Dear Sir or Madam:


My name is Robert, and I have just one more Excel formula issue before I fall asleep. The following formula works perfectly, but I want to add exceptions to it. I need Excel to find a cell that contains "minimum", "maximum", and range" with any other words except the following: "mean", "median", "mean absolute deviation", "interquartile range". If a cell contains "minimum", "maximum", and range" with any other words EXCLUDING the exceptions, I want to assign the result to a value of 2. If a cell contains "minimum", "maximum", and range" with any other words INCLUDING any of the exceptions, I want to assign the result to a value of 1.


=IF(L4="","",IF(AND(ISNUMBER(SEARCH("minimum",L4)),ISNUMBER(SEARCH("maximum",L4)),ISNUMBER(SEARCH("range",L4))),"2","0"))


Sincerely,
Robert
 
I don't completely understand what you mean by "Excel readable small sample". […]



Book1
ABC
1ORDER NO.TASKCREATED ON
2TT1234567SHIP1/1/2019
3TT1234567RPCK1/1/2019
4TT1234567PSHP1/2/2019
5(BLANK)CYCC1/1/2019
6TT1234567RPCK1/3/2019
7TT7654321RPCK1/10/2019
8TT9999999RPCK1/20/2019
9TT7654321SHIP1/25/2019
10TT8888888PSHP1/25/2019
Sheet2


This is an "excel readable small sample." Just copy and paste t in a sheet on your Excel system. You see you can use it immediately, that is, process it by means of formulas in order to generate a desired output.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
ABC
The minimum would most likely stay the same because unless the hit was less than 10 then it shouldnt change. Its the same with the maximum. Unless his hit is higher than 50 then it shouldnt change either. All of the other things would change because a new number was added in. The mean would change.The median would change. The mean absolute deviation would change. The would change. And finally, the interequality would change as well.=IF(B1="","",IF(AND(ISNUMBER(SEARCH("minimum",B1)),ISNUMBER(SEARCH("maximum",B1)),ISNUMBER(SEARCH("range",B1)),NOT(ISNUMBER(SEARCH({"mean","median","mean absolute deviation","interquartile range"},B1)))),2,1))

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]

</tbody>
Sheet2

This is an "excel readable small sample." Just copy and paste t in a sheet on your Excel system. You see you can use it immediately, that is, process it by means of formulas in order to generate a desired output.

Aladin,

I think I am about to call it quitting time soon because I am finding it more difficult to understand what you need from me. I don't know what else to do. Therefore, I hope I provided you with something that is productive. I tried to my table neat like yours, but I didn't have success.

Robert
 
Upvote 0
ABC
ORDER NO.TASKCREATED ON
TT1234567SHIP
TT1234567RPCK
TT1234567PSHP
(BLANK)CYCC
TT1234567RPCK
TT7654321RPCK
TT9999999RPCK
TT7654321SHIP
TT8888888PSHP

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]1/1/2019[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]1/1/2019[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]1/2/2019[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]1/1/2019[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]1/3/2019[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]1/10/2019[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]1/20/2019[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]1/25/2019[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]1/25/2019[/TD]

</tbody>
Sheet2

This is an "excel readable small sample." Just copy and paste t in a sheet on your Excel system. You see you can use it immediately, that is, process it by means of formulas in order to generate a desired output.


Okay...I have an idea. I have created this formula. If you see understand what I am trying to do with it, I am hoping you can fill-in the missing pieces to make it work. It is now 3:00 am EST, and I need to go to bed. I will check my email again after I wake up.

=IF(L4="","",IF(AND(ISNUMBER(SEARCH("minimum",L4)),ISNUMBER(SEARCH("maximum",L4)),ISNUMBER(SEARCH("range",L4)),ISNUMBER(SEARCH({"mean","median","mean absolute deviation","interquartile range"},L4)),1,IF(AND(ISNUMBER(SEARCH("minimum",L4)),ISNUMBER(SEARCH("maximum",L4)),ISNUMBER(SEARCH("range",L4)),NOT(ISNUMBER(SEARCH({"mean","median","mean absolute deviation","interquartile range"},L4)))),2,0))
 
Upvote 0
Aladin,

I think I am about to call it quitting time soon because I am finding it more difficult to understand what you need from me. I don't know what else to do. Therefore, I hope I provided you with something that is productive. I tried to my table neat like yours, but I didn't have success.

Robert

Okay...I have an idea. I have created this formula. If you see understand what I am trying to do with it, I am hoping you can fill-in the missing pieces to make it work. It is now 3:00 am EST, and I need to go to bed. I will check my email again after I wake up.

=IF(L4="","",IF(AND(ISNUMBER(SEARCH("minimum",L4)),ISNUMBER(SEARCH("maximum",L4)),ISNUMBER(SEARCH("range",L4)),ISNUMBER(SEARCH({"mean","median","mean absolute deviation","interquartile range"},L4)),1,IF(AND(ISNUMBER(SEARCH("minimum",L4)),ISNUMBER(SEARCH("maximum",L4)),ISNUMBER(SEARCH("range",L4)),NOT(ISNUMBER(SEARCH({"mean","median","mean absolute deviation","interquartile range"},L4)))),2,0))


I just want a sample from you with which can work, not formulas. That's all. (By the way, I tried to show you what posting a sample means.)
 
Upvote 0
This kind of formula really works best if you make an external table with the conditions you want. That way it's MUCH easier to change, read, and understand. For example, if I understand your request:

BCDEFG
The minimum would most likely stay the same because unless the hit was less than 10 then it shouldnt change. Its the same with the maximum. Unless his hit is higher than 50 then it shouldnt change either. All of the other things would change because a new number was added in. The mean would change.The median would change. The mean absolute deviation would change. The would change. And finally, the interequality would change as well. The range would increase.<
/td>
Score:Points:
Condition:Word list0=include, 1 = excludeWord list0=include, 1 = exclude
minimumminimum
maximummaximum
rangerange
mean
median
mean absolute deviation
interquartile range

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]2[/TD]
[TD="align: right"][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]

[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet20

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulasble>Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B3[/TH]
[TD="align: left"]{=IF(PRODUCT(ISNUMBER(SEARCH($D$4:$D$11,B1))-$E$4:$E$11),$D$2,IF((PRODUCT(ISNUMBER(SEARCH($F$4:$F$11,B1))-$G$4:$G$11)),$F$2,0))}[/TD]
[/TR]
</tbody>[/TABLE]



In D2 put the number of points you want. In D4:D11 put your word list, and in the corresponding row in column E, put a 0 if the word must be included, or a 1 if it must be excluded. Repeat in columns F:G. Then the B3 formula should do what you want.

I've been playing around with a shorter formula that allows adding more columns easily, but it requires a pretty awkward table in its current incarnation.[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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