More elegant way to do IF ()

B

Barb Reinhardt

My formula currently looks like this

=if(or(A=Green,A=Yellow,A=Red),1,0)

unfortunately A is a fairly long formula. Is there a more elegant way to do
this?

Thanks,
Barb Reinhardt
 
N

Niek Otten

Hi Barb,

I don't know the restrictions you might have, but if possible I would always store the A formula in a cell and use that address to
compare.

--
Kind regards,

Niek Otten

| My formula currently looks like this
|
| =if(or(A=Green,A=Yellow,A=Red),1,0)
|
| unfortunately A is a fairly long formula. Is there a more elegant way to do
| this?
|
| Thanks,
| Barb Reinhardt
 
C

CLR

Hi Barb..........
Maybe just put the long formula in a helper cell and refer to that cell in
your IF statement..........

hth
Vaya con Dios,
Chuck, CABGx3
 
B

Barb Reinhardt

I thought about that, but would prefer not to as I already have a lot in this
worksheet.

Thanks for your help.
 
N

Niek Otten

Hi Barb,

Consider a defined name for your formula.


--
Kind regards,

Niek Otten

|I thought about that, but would prefer not to as I already have a lot in this
| worksheet.
|
| Thanks for your help.
|
| "Niek Otten" wrote:
|
| > Hi Barb,
| >
| > I don't know the restrictions you might have, but if possible I would always store the A formula in a cell and use that
address to
| > compare.
| >
| > --
| > Kind regards,
| >
| > Niek Otten
| >
| > | > | My formula currently looks like this
| > |
| > | =if(or(A=Green,A=Yellow,A=Red),1,0)
| > |
| > | unfortunately A is a fairly long formula. Is there a more elegant way to do
| > | this?
| > |
| > | Thanks,
| > | Barb Reinhardt
| >
| >
| >
 
R

Ron Coderre

Try something like this:

Define this Named Range:
Name: LU_TrafficLights
Refers to: ={"Green","Yellow","Red"}

Now, for a value in A1
B1: =IF(OR(A1=LU_TrafficLights),1,0)

Is that something you can work with?

***********
Regards,
Ron

XL2002, WinXP-Pro
 
N

Niek Otten

You could create a separate worksheet for this, and give the one cell you need a defined name.
It's very likely that you can't even notice the difference in performance and memory usage, and it makes it easier to keep control
of your total workbook.

--
Kind regards,

Niek Otten

|I thought about that, but would prefer not to as I already have a lot in this
| worksheet.
|
| Thanks for your help.
|
| "Niek Otten" wrote:
|
| > Hi Barb,
| >
| > I don't know the restrictions you might have, but if possible I would always store the A formula in a cell and use that
address to
| > compare.
| >
| > --
| > Kind regards,
| >
| > Niek Otten
| >
| > | > | My formula currently looks like this
| > |
| > | =if(or(A=Green,A=Yellow,A=Red),1,0)
| > |
| > | unfortunately A is a fairly long formula. Is there a more elegant way to do
| > | this?
| > |
| > | Thanks,
| > | Barb Reinhardt
| >
| >
| >
 
Top