If Formula

eramirez148

Board Regular
Joined
Aug 17, 2022
Messages
54
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
Platform
  1. Windows
  2. MacOS
I need a formula that will give me the following results in column D. If there is multiple cells with in column A and column B and C show active for any of the repetative cells or non repetative cells then the results should be "OK" otherwise the results should be "Violation."

Product nameCBISSAPResults
Protein YogurtActiveActiveOK
2​
talian BeefActiveActiveOK
3​
Chicken DrumActiveViolation
4​
Chicken DrumActiveViolation
5​
Chicken DrumsticksActiveViolation
6​
Trail MixActiveOK
7​
Trail MixActiveActiveOK
8​
Grains ChickenActiveActiveOK
9​
PopcornActiveActiveOK
10​
Red PepperActiveActiveOK
11​
BunsActiveActiveOK
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
wait. Can you explain the difference with row 5 and row 6?
 
Upvote 0
row 6 and 3 seem to be the same scenario? Please explain more.
 
Upvote 0
Row five does not have a repetitive row and it also does not have "active" matching in column B and C.
Whereas row 6 repeats in row 7. And row 7 has "Active" match in column B and C. So I want the formula to also capture repetitive rows that contain "active" match in column B and C
 
Upvote 0
I need a formula that will give me the following results in column D. If there is multiple cells with in column A and column B and C show active for any of the repetative cells or non repetative cells then the results should be "OK" otherwise the results should be "Violation."

Column A
Column B
Column CColumn D
Protein YogurtActiveActiveOK
2​
talian BeefActiveActiveOK
3​
Chicken DrumActiveViolation
4​
Chicken DrumActiveViolation
5​
Chicken DrumsticksActiveViolation
6​
Trail MixActiveOK
7​
Trail MixActiveActiveOK
8​
Grains ChickenActiveActiveOK
9​
PopcornActiveActiveOK
10​
Red PepperActiveActiveOK
11​
BunsActiveActiveOK
 
Upvote 0
I think i understand that. Will you ever have column B blank, and column C "Active"?
 
Upvote 0
Here's a super janky formula that works up to 200 rows.

=IF(AND(ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$B$2:$B$200,"")))),ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$C$2:$C$200,""))))),"OK","Violation")

Paste it in D2. Good luck!

1684958275436.png
 
Upvote 0
Hi dalvin657, this formula worked perfect. However, I came into another issue. If column B and C matched "Inactive" text can we have the formula also read these and the result be "OK"
 
Upvote 0
Here's a super janky formula that works up to 200 rows.

=IF(AND(ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$B$2:$B$200,"")))),ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$C$2:$C$200,""))))),"OK","Violation")

Paste it in D2. Good luck!

View attachment 92254
Hi dalvin657, this formula worked perfect. However, I came into another issue. If column B and C matched "Inactive" text can we have the formula also read these and the result be "OK"
 
Upvote 0
I think i understand that. Will you ever have column B blank, and column C "Active"?
Hello, yes there will be instances where column B is blank and column C active.

A different user provided the following formula below and it worked out out great. However, I ran into some instances were column B and C are both blank in such instances I want the result to be "OK" will this be possible to include?

=IF(AND(ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$B$2:$B$200,"")))),ISNUMBER(SEARCH("Active",TEXTJOIN(",",TRUE,IF($A$2:$A$200=A2,$C$2:$C$200,""))))),"OK","Violation")
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,276
Members
449,093
Latest member
Vincent Khandagale

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