Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

IF Statement Excel

Posted on 2013-12-04
Medium Priority
220 Views
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
Question by:gisvpn
• 2
• 2

LVL 50

Accepted Solution

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

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

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

LVL 4

Assisted Solution

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

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

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

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

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