?
Solved

IF Statement Excel

Posted on 2013-12-04
5
Medium Priority
?
217 Views
Last Modified: 2013-12-04
Hello,

I would like to check to see whether the value in Cell A3 is present at all in the range of cells (A2:N24) on the Week1 worksheet as below.


=IF(A3=('Week 1'!A2:N24),"Yes","No")

However it always returns no because I think it is looking for the condition of that value being in every cell in that range?

Can someone please point me in the right direction on the right formula? I just want to confirm that the value present in cell A3 is in atleast one of the cells in range  'Week 1'!A2:N24'.

Regards,

GISVPN
0
Comment
Question by:gisvpn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 39695666
Try using COUNTIF like this

=IF(COUNTIF('Week 1'!A2:N24,A3)>0,"Yes","No")

regards, barry
0
 
LVL 15

Assisted Solution

by:JimFive
JimFive earned 1000 total points
ID: 39695685
The only way I can think of to do this is to put a formula at the bottom of each column:
=vlookup(A3, A2:A24, 1,false)
This will put the value found in the cell or #NA if not found.

And then put a formula to look for success
=if(isna(Hlookup(A3,A25:N25,1,false)),"No","Yes")
0
 
LVL 15

Assisted Solution

by:JimFive
JimFive earned 1000 total points
ID: 39695691
Barry's is better.  Nice Solution
0
 
LVL 4

Assisted Solution

by:andrew_man
andrew_man earned 500 total points
ID: 39695708
=IF(COUNTIF(Week 1'!A2:N24,A3),"Yes","No")

no need greater than 0
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39695733
Note that is is also possible to use OR like this

=IF(OR(A3='Week 1'!A2:N24),"Yes","No")

but that needs to be "array entered" with CTRL+SHIFT+ENTER so COUNTIF is probably preferable in most cases.

"no need greater than 0"

that's true andrew_man, but sometimes I think the added clarity outweights the small space saving!

regards, barry
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question