Home |
Search |
Today's Posts |
#1
|
|||
|
|||
If statement checking list
Is there a way to use an If statement to see if a cell value is equal to any value in the list and return a "yes" if true or "no" if false? The list is in the same worksheet.
|
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
If statement checking list
hi,
=IF(COUNTIF(B:B,A1)0,TRUE,FALSE) Sub Macro1() v = Range("A1") ' adapt cell value If Application.CountIf(Range("B:B"), v) 0 Then ' adapt column MsgBox True Else MsgBox False End If End Sub -- isabelle Le 2012-01-19 12:35, B Rucks a écrit : Is there a way to use an If statement to see if a cell value is equal to any value in the list and return a "yes" if true or "no" if false? The list is in the same worksheet. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
If statement checking list
B Rucks presented the following explanation :
Is there a way to use an If statement to see if a cell value is equal to any value in the list and return a "yes" if true or "no" if false? The list is in the same worksheet. Take a look at the LOOKUP functions in online help. You can use one of those to check the list range combined with... IF(NOT(ISERROR(?LOOKUP(...)))) -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
If statement checking list
GS formulated the question :
B Rucks presented the following explanation : Is there a way to use an If statement to see if a cell value is equal to any value in the list and return a "yes" if true or "no" if false? The list is in the same worksheet. Take a look at the LOOKUP functions in online help. You can use one of those to check the list range combined with... IF(NOT(ISERROR(?LOOKUP(...)))) Isabelle's solution is a better choice since it uses less functions. You could modify it as follows to get the results specified... =COUNTIF(ListRange,Criteria)0,"Yes","No") ...where ListRange is the address where the list is located, and Criteria is the value you want to find OR a ref to a cell that contains the value. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
If statement checking list
Correction...
=IF(COUNTIF(ListRange,Criteria)0,"Yes","No") -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement checking if a cell's text is red | Excel Worksheet Functions | |||
Checking whether a value in a list is present in a second list | Excel Discussion (Misc queries) | |||
checking for a value in a list | Excel Discussion (Misc queries) | |||
If Statement Checking Formula NOT Value in a Cell | Excel Discussion (Misc queries) | |||
Checking if value is in a list | Excel Worksheet Functions |