Help with IF

T

tommcbrny

Hello,

I need to capture text from cell D2 (example only) if cell D1 contains
"abc", otherwise use the text from D1. I am able to do this with the
following formula:
(IF(ISERR(FIND("abc",D1,1)),D1,D2)

I would like to expand this now so that if D1 contains either "abc", "def",
"ghi", "jkl", or ""mno", I capture the text in D2, else use the text from D1.
Is this possible? I have fiddled with the original by strining the
additional requirements on and can get Excel to accept the formula as
"correct" but not accomplish what I need to do.

Thank you,
Tom
 
V

veryeavy

I need to capture text from cell D2 (example only) if cell D1 contains
"abc", otherwise use the text from D1. I am able to do this with the
following formula:
(IF(ISERR(FIND("abc",D1,1)),D1,D2)

I would like to expand this now so that if D1 contains either "abc", "def",
"ghi", "jkl", or ""mno", I capture the text in D2, else use the text from D1.
Is this possible? I have fiddled with the original by strining the
additional requirements on and can get Excel to accept the formula as
"correct" but not accomplish what I need to do.

Can you not use something like:

if(or(D1="abc",D1="def", etc),D2,D1)

Best Regards,

Matt
 
F

FiluDlidu

If you don't want "abcd" to be a match, but "ABC" is OK, you can use the
following:

=IF(OR(D1="abc",D1="def",D1="ghi",D1="jkl",D1="mno"),D2,D1)

If you don't want "ABC" to be a match, but "abcd" is OK, you can use:

=IF(OR(1-ISERROR(FIND("abc",D1)),1-ISERROR(FIND("def",D1)),1-ISERROR(FIND("ghi",D1)),1-ISERROR(FIND("jkl",D1)),1-ISERROR(FIND("mno",D1))),D2,D1)

If you want neither "ABC" or "abcd" to be matches, you can use:

=IF(OR(1-ISERROR(FIND("abc",D1)),1-ISERROR(FIND("def",D1)),1-ISERROR(FIND("ghi",D1)),1-ISERROR(FIND("jkl",D1)),1-ISERROR(FIND("mno",D1))),IF(OR(D1="abc",D1="def",D1="ghi",D1="jkl",D1="mno"),D2,D1),D1)

If you want them both "ABC" and "abcd" to be a match, you can use:

=IF(OR(1-ISERROR(SEARCH("abc",D1)),1-ISERROR(SEARCH("def",D1)),1-ISERROR(SEARCH("ghi",D1)),1-ISERROR(SEARCH("jkl",D1)),1-ISERROR(SEARCH("mno",D1))),D2,D1)
 
T

tommcbrny

Thanks, this almost works, but I should have been more clear in my question.
The cell being tested will not contain exactly "abc", "def", etc, but more
along the line of "abc-123", "def-432", and so on. Is there any way to use
the list but require a match on the entire list value in question?

Thanks again.
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

collapse rows into one 2
lookup with IF criteria 2
Index Match ? 6
Data Alignment in columns 2
Index / match combination 8
SEARCH IN SUMPRODUCT 8
Sorting 2
@Sum Conditional Values within a Macro 1

Top