return TRUE in Column B where Column A cell values is either BLANK, equals "To be Determined", "UNKNOWN" or contains COMMA ELSE False

Ananthak275

Board Regular
Joined
Aug 22, 2020
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
  2. MacOS
Trying to create Column B where values in Column A

the following criteria for TRUE:
1. Cell value equals "To be Determined" OR "UNKNOWN"
2. Cell value equals BLANK
3. Cell value contains COMMA

Column AColumn B
UnknownTrue
AppleFalse
To be DeterminedTrue
True
TreesFalse
Apple, TreesTrue
Trees, AppleTrue
OrangeFalse
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
UPDATE:
1. Cell value equals "To be Determined" OR "UNKNOWN"
2. Cell value equals BLANK
3. Cell value contains COMMA OR "/"
 
Upvote 0
EDIT

how about
=OR(A2="to be determined", A2="unknown",A2="",NOT(ISERROR(SEARCH(",",A2,1))),NOT(ISERROR(SEARCH("/",A2,1))) )

Book4
ABC
1Column AColumn B
2UnknownTRUETRUE
3AppleFALSEFALSE
4To be DeterminedTRUETRUE
5TRUETRUE
6TreesFALSEFALSE
7Apple, TreesTRUETRUE
8Trees, AppleTRUETRUE
9Or/angeFALSETRUE
10Feed/jonTRUE
11orangeFALSE
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=OR(A2="to be determined", A2="unknown",A2="",NOT(ISERROR(SEARCH(",",A2,1))),NOT(ISERROR(SEARCH("/",A2,1))))
 
Upvote 0
Solution
Fortheheckofit, I was working on a code solution ('cause that's my bent) and was using
VBA Code:
If rngValue = "To be Determined" Or rngValue = "UNKNOWN" Or rngValue = "" Or InStr(1, rngValue, ",") > 0 Or InStr(1, rngValue, ",") > 0 Then
     testVal = "True"
Else
     testVal = "False"
End If
but thought, "surely I could use Select Case block instead, but how to do that when you can't perform tests (such as Instr) on a Case statement"? After one or two wobbly pops I think the answer came to me. I can test/post if anyone is interested - but warning - I'm not 100% sure I figured it out.
 
Upvote 0
Try this using select case:
VBA Code:
Sub Select_Me()
'Modified  5/31/2022  11:42:59 PM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To Lastrow
    Select Case Cells(i, 1).Value
        Case "To be Determined", "UNKNOWN", ""
            Cells(i, 2).Value = True
        Case Else
            Cells(i, 2).Value = "False"
    End Select
        
    Select Case True
        Case InStr(Cells(i, 1).Value, ",") > 0
        Case InStr(Cells(i, 1).Value, "/") > 0
        
            Cells(i, 2).Value = "True"
    End Select
Next
End Sub
 
Upvote 0
Might as well test for True in all cases? I did that using a function so that the entire column doesn't get calculated each time. Code is just 12 lines all inclusive. Not saying that this way is better, just different I guess.
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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