Thread: If statemrent
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default If statemrent

You have duplicated some of your checks. You have:

IF(C6="39300",'MA RUGS'!I10,IF(C6="49340",'MA
RUGS'!P10,IF(C6="39300",'MA RUGS'!I10,IF(C6="49340",'MA
RUGS'!P10,

so this can be reduced to:

IF(C6="39300",'MA RUGS'!I10,IF(C6="49340",'MA
RUGS'!P10,

thus saving you two levels of nesting.

Here's another way - set up this table in the same sheet as your
formula, say in cells X1 to Y6:

'15764 J
'14484 I
'99922 L
'39300 I
'49340 P
'21604 R

The apostrophe is to turn the numbers into text - you won't see them
on screen. Then use this formula:

=IF(ISNA(VLOOKUP(C6,X$1:Y$6,1,0)),0,INDIRECT("'MA RUGS'!"&VLOOKUP(C6,X
$1:Y$6,2,0)&"10"))

The table can be made much larger, and you only need to change the
table references in the VLOOKUP parts of the formula. Note that if you
wanted to copy this down several rows, you would need to change the
final "10" (to something like ROW(A10))

Hope this helps.

Pete

On Oct 3, 4:32 pm, mac wrote:
Hello,
I have this if statement and when I go to add 2 more if statements I get an
error. Can you help? Any help will be greatly appreciated. Thank you

=IF(C6="15764",'MA RUGS'!J10,IF(C6="14484",'MA RUGS'!I10,IF(C6="99922",'MA
RUGS'!L10,IF(C6="39300",'MA RUGS'!I10,IF(C6="49340",'MA
RUGS'!P10,IF(C6="39300",'MA RUGS'!I10,IF(C6="49340",'MA
RUGS'!P10,IF(C6="21604",'MA RUGS'!R10,0))))))))
--
thank you mac