condition check for multiple words

mwvirk

Board Regular
Joined
Mar 2, 2011
Messages
247
Office Version
  1. 2016
Platform
  1. Windows
hi

1- if a cell contains a specific text and if I want to change the cell format then it can be done for multiple words.
like in the attached picture, I want to see if the cell contains the word APL and then change the cell color. but is it possible for me can search multiple words using the single condition check?
I want to change the cell color if it contains 3 different words: APL ABC XYZ

2- if cell in range A contains only APL ABC XYZ then cell in range B show 100%


Untitled.jpg
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
1697147011443.png



Book1
ABC
1
2
3
4
5
6
7
8
9GRAPL ABC XYZTRUE
10UAAPL XYZTRUE
11CDAPL ABC XYZTRUE
12DXAPL ABCTRUE
13YIAPL ABCTRUE
14GKXYZTRUE
15HSABC XYZTRUE
16HBAPL XYZTRUE
17FKAPL ABCTRUE
18LQXYZTRUE
19RBABCTRUE
20JEAPL ABCTRUE
21SYABCTRUE
22UZFALSE
23ENXYZTRUE
24NOAPL ABCTRUE
25IUABC XYZTRUE
26ABFALSE
27LMABC XYZTRUE
28JBAPL XYZTRUE
29TMABC XYZTRUE
30DLAPL XYZTRUE
31HPXYZTRUE
32MFAPL ABCTRUE
33ASAPL ABCTRUE
34LLABC XYZTRUE
35PBABC XYZTRUE
36SGAPL ABC XYZTRUE
37WAABC XYZTRUE
38GMAPL ABCTRUE
39
mwvirk
Cell Formulas
RangeFormula
C9:C38C9=(ISNUMBER(FIND("APL",A9)) +ISNUMBER(FIND("ABC",A9)) +ISNUMBER(FIND("XYZ",A9)))>0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A9:A38Expression=(ISNUMBER(FIND("APL",A9)) +ISNUMBER(FIND("ABC",A9)) +ISNUMBER(FIND("XYZ",A9)))>0textNO


If you want to check that all 3 are in each cell then use this formula as the conditional equation:

Excel Formula:
=(ISNUMBER(FIND("APL",A9))+ISNUMBER(FIND("ABC",A9))+ISNUMBER(FIND("XYZ",A9)))= 3
 
Upvote 0
thanks awoohaw
actually the words in the range A will be as below
APL
XYZ
ABC
DEF
XYZ
GHJ
GHA
APL
GHA
ABC
APL
APL
XYZ

I ONLY WANT TO CHANGE COLOR IF ITS APL or ABC or XYZ
 
Upvote 0
thanks awoohaw
actually the words in the range A will be as below
APL
XYZ
ABC
DEF
XYZ
GHJ
GHA
APL
GHA
ABC
APL
APL
XYZ

I ONLY WANT TO CHANGE COLOR IF ITS APL or ABC or XYZ
then the first formula for conditional formatting should work. If you're seeking EXACT matches for one of the three then use this:

Excel Formula:
=OR("APL"=A9,"ABC"=A9,"XYZ"=A9)
 
Upvote 0
then the first formula for conditional formatting should work. If you're seeking EXACT matches for one of the three then use this:

Excel Formula:
=OR("APL"=A9,"ABC"=A9,"XYZ"=A9)

perfect.
this one is working:
=(ISNUMBER(FIND("APL",A9)) +ISNUMBER(FIND("ABC",A9)) +ISNUMBER(FIND("XYZ",A9)))>0

just to understand, although the range A9:A38 is selected but in formula, it's only A9
then how it's working for the entire range?

now since the required words are found. i want to add a specific number in the next cell:

APL 7.5%
XYZ 7.5%
ABC 7.5%
DEF 15%
XYZ 7.5%
GHJ 15%
GHA 15%
APL 7.5%
GHA 15%
ABC 7.5%
APL 7.5%
APL 7.5%
XYZ 7.5%

only for the required words. for others it can be 15%
it's better if we can search and add 7.5% only and for all the rest it will be 15% (using else function)
then i will use another condition formatting if any thing in B is more than 15% then the cell format will be changed in a different color
 
Upvote 0
When I create a conditional formatting rule, I find it best to apply to the top-left cell and then copy and paste using the "copy formatting tool".
What I've done in column C, which you do not need is to test the rules. The conditional formatting rule requirement is to create a rule that results in TRUE.
So, what i've done in C9 is to create a rule that works for cell A9. Then copy that to C38. If that works for all the cells then the formula is good.
Then copy the rule in C9 that is based on cell A9, into the conditional formatting for A9.
1. Select in edit mode C9​
2. copy the C9 formula​
3. select cell A9​
4. conditionally format A9, using "use a formula" method.​
5. paste the formula in the formula bar.​
6. choose your formatting.​
7. Click OK all the way out.​
8 Select A9​
9 Click the format painter​
10 drag down.​

Are you saying you have multiple conditions in the cells for conditional formatting?
That is not particularly kind to the forum.

Based on what you've said, I am guessing you need to add additional CF conditions.
Before I go any further,.. are there other surprises about your question.
As I read it now you have 4 scenarios:
1. the 3 text strings are not present and the percent in B is < 15% NO CF​
2. the 3 text strings are present and the percent in B is < 15% Rule 1 of CF​
3. the 3 text strings are not present and the percent in B is >= 15% Rule 2 of CF​
4. the 3 text strings are present and the percent in B is >= 15% Rule 3 of CF​

is that correct, is there anything else?
 
Upvote 0
if the cell value A1:A25 contains any of these (APL or ABC or XYZ), then cell B1:B25 should automatically input a number 7.5%
In any other words, it should input 15%
e.g. if my word in A1 is APL then right now i am typing 7.5% it manually in B1
 
Upvote 0
this should work:
Excel Formula:
=IF((ISNUMBER(FIND("APL",A9)) +ISNUMBER(FIND("ABC",A9)) +ISNUMBER(FIND("XYZ",A9)))>0,.075,.15)

(it is using the boolean formula that was in Cell C9 and putting it into a IF function.)


Book1
AB
1
2
3
4
5
6
7
8GRAPL ABC XYZ7.5%
9UAAPL XYZ7.5%
10CDAPL ABC XYZ7.5%
11DXAPL ABC7.5%
12YIAPL ABC7.5%
13GKXYZ7.5%
14HSABC XYZ7.5%
15HBAPL XYZ7.5%
16FKAPL ABC7.5%
17LQXYZ7.5%
18RBABC7.5%
19JEAPL ABC7.5%
20SYABC7.5%
21UZ15.0%
22ENXYZ7.5%
23NOAPL ABC7.5%
24IUABC XYZ7.5%
25AB15.0%
26LMABC XYZ7.5%
27JBAPL XYZ7.5%
28TMABC XYZ7.5%
29DLAPL XYZ7.5%
30HPXYZ7.5%
31MFAPL ABC7.5%
32ASAPL ABC7.5%
33LLABC XYZ7.5%
34PBABC XYZ7.5%
35SGAPL ABC XYZ7.5%
36WAABC XYZ7.5%
37GMAPL ABC7.5%
mwvirk
Cell Formulas
RangeFormula
B8:B37B8=IF((ISNUMBER(FIND("APL",A8)) +ISNUMBER(FIND("ABC",A8)) +ISNUMBER(FIND("XYZ",A8)))>0,0.075,0.15)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A8:A37Expression=(ISNUMBER(FIND("APL",A8)) +ISNUMBER(FIND("ABC",A8)) +ISNUMBER(FIND("XYZ",A8)))>0textNO
 
Upvote 1
Solution
thank you awoohaw
7.5% and 15% is showing correctly.
my cell range for the actual sheet is 2:1200
so when i copied the formula in this range, i am getting 15% even if there is no word in cell A
how can i remove all these 0s
i will share the screenshot of XL2BB of my actual sheet.
thank a lot for the help. appreciate.



Untitled.jpg




MWVirk PSX Portfolio v0001 (Testing Payouts Sheet) (Testing Copy Only).xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1Ex-DateScriptSharesFace ValueCash Dividend %Cash Dividend ReceivableCash Dividend Receivable Per ShareTax Deductions %Tax Deductions AmountCash Dividend Tax Charged Per ShareCash Dividend Received Per ShareCash Dividend ReceivedDividend Warrant ReceivedDate Dividend Cash ReceivedBonus Shares %Bonus SharesBonus Shares Confirmation ReceivedDate Bonus Shares ReceivedRight Shares %Right SharesRight Shares PremiumRight Shares Face Value With PremiumRight Shares Confirmation ReceivedDate Right Shares Received
215-Apr-2021PKGS10010225.00%2,250.0022.5015.00%338.003.3819.121,912.00Yes25-May-20210.00%0  
316-Sep-2021KOHE1,0001052.50%5,250.005.257.50%394.000.394.864,856.00Yes04-Oct-20210.00%0  
406-Oct-2021NATF1,0005100.00%5,000.005.0015.00%750.000.754.254,250.00Yes03-Nov-202125.00%250Yes05-Nov-2021  
510-Nov-2021SPWL5,0001020.00%10,000.002.007.50%750.000.151.859,250.00Yes25-Nov-20210.00%0  
610-Nov-2021GHGL2,0001015.00%3,000.001.5015.00%450.000.231.282,550.00Yes24-Nov-20210.00%0  
710-Dec-2021KOHE1,0001077.50%7,750.007.757.50%581.250.587.177,168.75Yes23-Dec-20210.00%0  
831-Jan-2022SPWL5,0001050.00%25,000.005.007.50%1,875.000.384.6323,125.00Yes21-Feb-20220.00%0  
907-Feb-2022KAPCO3,5001040.00%14,000.004.0015.00%2,100.000.603.4011,900.00Yes24-Feb-20220.00%0  
1010-Feb-2022APL50010150.00%7,500.0015.0015.00%1,125.002.2512.756,375.00Yes01-Mar-20220.00%0  
1124-Feb-2022KOHE1,0001027.50%2,750.002.757.50%206.250.212.542,543.75Yes08-Mar-20220.00%0  
1228-Feb-2022SUTM2001050.00%1,000.005.0015.00%150.000.754.25850.00Yes15-Mar-20220.00%0  
1318-Apr-2022PAKOXY520100.00%0.000.0015.00%0.000.000.000.0025.00%130Yes19-May-2022  
1413-Apr-2022SPWL5,0001010.00%5,000.001.007.50%375.000.080.934,625.00Yes18-May-20220.00%0  
1520-Apr-2022SGF1,0001020.00%2,000.002.0015.00%300.000.301.701,700.00Yes18-May-20220.00%0  
1627-Apr-2022ENGRO50010120.00%6,000.0012.0015.00%900.001.8010.205,100.00Yes17-May-20220.00%0  
1713-May-2022PABC1,0001015.00%1,500.001.5015.00%225.000.231.281,275.00Yes26-May-20220.00%0  
1821-Jul-2022SPWL5,0001045.00%22,500.004.507.50%1,687.000.344.1620,813.00Yes05-Aug-20220.00%0  
1911-Aug-2022KOHE1,0001015.00%1,500.001.507.50%113.000.111.391,387.00Yes19-Aug-20220.00%0  
2018-Aug-2022WAVES7,500100.00%0.000.0015.00%0.000.000.000.0020.00%1,500Yes05-Dec-2022  
2120-Sep-2022CEPB2,150100.00%0.000.0015.00%0.000.000.000.0010.00%215Yes21-Oct-2022  
2211-Oct-2022HUBC3010155.00%465.0015.507.50%34.881.1614.34430.12Yes01-Nov-20220.00%0  
2312-Oct-2022NATF8,2505100.00%41,250.005.0015.00%6,187.500.754.2535,062.50Yes01-Nov-20220.00%0  
2428-Oct-2022ENGRO50010100.00%5,000.0010.0015.00%750.001.508.504,250.00Yes16-Nov-20220.00%0  
2504-Nov-2022SPWL5,0001015.00%7,500.001.507.50%563.000.111.396,937.00Yes21-Nov-20220.00%0  
2609-Nov-2022FABL1,0001055.00%5,500.005.5015.00%825.000.834.684,675.00Yes23-Nov-20220.00%0  
2702-Dec-2022GGL11,000100.00%0.000.0015.00%0.000.000.000.0010.00%1,100Yes16-Dec-2022  
2823-Feb-2023KOHE1,0001030.00%3,000.003.007.50%225.000.232.782,775.00Yes06-Mar-20230.00%0  
2907-Mar-2023KAPCO3,5001035.00%12,250.003.5015.00%1,838.000.532.9710,412.00Yes21-Mar-20230.00%0  
3020-Apr-2023PAKOXY1,000100.00%0.000.0015.00%0.000.000.000.0025.00%250Yes20-May-2023  
3120-Apr-2023SPWL5,0001025.00%12,500.002.507.50%938.000.192.3111,562.00Yes05-May-20230.00%0  
3203-May-2023KOHE1,0001020.00%2,000.002.007.50%150.000.151.851,850.00Yes11-May-20230.00%0  
3328-Sep-2023APL2,00010150.00%30,000.0015.0015.00%4,500.002.2512.7525,500.00No0.00%0  
3428-Sep-2023POL2,00010600.00%120,000.0060.0015.00%18,000.009.0051.00102,000.00No0.00%0  
3506-Oct-2023HUBC5001060.00%3,000.006.007.50%225.000.455.552,775.00No0.00%0  
3618-Oct-2023AIRLINK3,0001025.00%7,500.002.5015.00%1,125.000.382.136,375.00No0.00%0  
3719-Oct-2023TGL5,0001060.00%30,000.006.0015.00%4,500.000.905.1025,500.00No0.00%0  
380.00%0.000.0015.00%0.000.000.000.000.00%0  
PSX Payouts Status
Cell Formulas
RangeFormula
F2:F38F2=(C2*E2)*D2
G2:G38G2=IF(C2>0,F2/C2,0)
H2:H38H2=IF((ISNUMBER(FIND("SPWL",B2)) +ISNUMBER(FIND("KOHE",B2)) +ISNUMBER(FIND("HUBC",B2)))>0,0.075,0.15)
J2:J38J2=G2-K2
K2:K38K2=IF(C2>0,L2/C2,0)
L23:L38,L2:L21L2=F2-I2
I32:I38,I30,I26:I28,I20:I24,I4:I17I4=F4*H4
P2:P38P2=C2*O2
T2:T38T2=IF(AND(C2<>"",S2<>""),C2*S2,"")
V2:V38V2=IF(AND(D2<>"",U2<>""),D2+U2,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B40Expression=OR("SPWL"=B2,"KOHE"=B2,"HUBC"=B2)textNO
M1001:M1131,Q1001:Q1131,M2:M168,Q2:Q168,W2:W168Cell Valuecontains "No"textNO
M1001:M1131,Q1001:Q1131,M2:M168,Q2:Q168,W2:W168Cell Valuecontains "Yes"textNO
Cells with Data Validation
CellAllowCriteria
B2:B38List=#REF!
 
Last edited:
Upvote 0
please note that APL ABC XYZ were temporary words. since i am sharing the actual sheet, you can find the correct cells and words.
thanks
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,024
Members
449,092
Latest member
ikke

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