Thread: Help with IF
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
smartin smartin is offline
external usenet poster
 
Posts: 915
Default Help with IF

Ah, well, that's different I suppose.

But let's make sure I understand the problem:

Suppose D1 contains "123abc456". The list allows "abc" as a "positive"
value. This should return D1, right?

This being the case, I can't think of a one-shot solution.

Something that does work involves a helper column alongside the positive
value range. I put the positive values in F and the following in G:

=FIND(F1,$D$1)

Fill this down appropriately.

In some other cell put this array* formula

=IF(MAX(IF(NOT(ISERROR(G1:G3)),G1:G3))0,D1,D2)

Adjust ranges in G as necessary.

*Commit array formula with Ctrl+Shift+Enter, not just Enter.

tommcbrny wrote:
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

"smartin" wrote:

tommcbrny wrote:
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,

Hi Tom

Put the list of "positive" values (abc, def, etc.) in some
out-of-the-way place and name this range "MyStuff".

Then use

=IF(ISNA(VLOOKUP(D1,MyStuff,1,false)),D2,D1)