ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help with IF statement (https://www.excelbanter.com/excel-discussion-misc-queries/145265-help-if-statement.html)

XFILES

Help with IF statement
 
Here's what I have and what I'm trying to do. I have a different country
names in cells A1 through A6. For example, A1 says Russia, A2 says US, A3
says UK, and so on.

In cell G1, G2, G3 I have more countries which are part of the group I have
called EM. G1 has Russia, G2 has Mexico, and G3 has Brazil in it. Again,
these three cells are in a group called EM.

What I want to do is write a function in cell B1 that will look at what
country is in A1 and if the country in A1 matches a country in the group EM
it will say "Yes". If it does not match a country in the group EM it will
say "No". Then I would just copy the formula down from B1. Any ideas. I
believe it will be an IF statement and maybe an OR statement, but I'm not
sure how to write it. Any help is appreciated. Thanks.

Toppers

Help with IF statement
 
Try:

=IF(ISNA(MATCH(A1,$G$1:$G$3,0)),"No","Yes")

"XFILES" wrote:

Here's what I have and what I'm trying to do. I have a different country
names in cells A1 through A6. For example, A1 says Russia, A2 says US, A3
says UK, and so on.

In cell G1, G2, G3 I have more countries which are part of the group I have
called EM. G1 has Russia, G2 has Mexico, and G3 has Brazil in it. Again,
these three cells are in a group called EM.

What I want to do is write a function in cell B1 that will look at what
country is in A1 and if the country in A1 matches a country in the group EM
it will say "Yes". If it does not match a country in the group EM it will
say "No". Then I would just copy the formula down from B1. Any ideas. I
believe it will be an IF statement and maybe an OR statement, but I'm not
sure how to write it. Any help is appreciated. Thanks.


JE McGimpsey

Help with IF statement
 
If by "a group" you mean a named range, then

B1: =IF(COUNTIF(em, A1),"Yes","No")

Or you could use the ranges directly:

B1: =IF(COUNTIF(G1:G3,A1),"Yes","No")

If that doesn't work, please explain what you mean by "group"

In article ,
XFILES wrote:

Here's what I have and what I'm trying to do. I have a different country
names in cells A1 through A6. For example, A1 says Russia, A2 says US, A3
says UK, and so on.

In cell G1, G2, G3 I have more countries which are part of the group I have
called EM. G1 has Russia, G2 has Mexico, and G3 has Brazil in it. Again,
these three cells are in a group called EM.

What I want to do is write a function in cell B1 that will look at what
country is in A1 and if the country in A1 matches a country in the group EM
it will say "Yes". If it does not match a country in the group EM it will
say "No". Then I would just copy the formula down from B1. Any ideas. I
believe it will be an IF statement and maybe an OR statement, but I'm not
sure how to write it. Any help is appreciated. Thanks.


XFILES

Help with IF statement
 
Thank you very much. Both solutions in this post and the previous post
worked. Thank you for all the help. I appreciate it so much.

"JE McGimpsey" wrote:

If by "a group" you mean a named range, then

B1: =IF(COUNTIF(em, A1),"Yes","No")

Or you could use the ranges directly:

B1: =IF(COUNTIF(G1:G3,A1),"Yes","No")

If that doesn't work, please explain what you mean by "group"

In article ,
XFILES wrote:

Here's what I have and what I'm trying to do. I have a different country
names in cells A1 through A6. For example, A1 says Russia, A2 says US, A3
says UK, and so on.

In cell G1, G2, G3 I have more countries which are part of the group I have
called EM. G1 has Russia, G2 has Mexico, and G3 has Brazil in it. Again,
these three cells are in a group called EM.

What I want to do is write a function in cell B1 that will look at what
country is in A1 and if the country in A1 matches a country in the group EM
it will say "Yes". If it does not match a country in the group EM it will
say "No". Then I would just copy the formula down from B1. Any ideas. I
believe it will be an IF statement and maybe an OR statement, but I'm not
sure how to write it. Any help is appreciated. Thanks.




All times are GMT +1. The time now is 10:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com