View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Complicated formula not working in 97

=hasformula() expects a range, but you're returning a value (string/number with
=vlookup):

IF(HasFormula(VLOOKUP(B28,IS_weap_table,MATCH("Dam ",IS_weap_head,0),0))

maybe if you're returning a value that looks like an address (Like C99)

IF(HasFormula(indirect(VLOOKUP(B28,IS_weap_table,
MATCH("Dam",IS_weap_head,0),0))), ...

Or maybe that name error occurs because you don't have a range named
IS_weap_table or is_weep_head???

"Adam Kroger

Below is the formula (spaced to make the IFs easier to read).

=IF(
AND(AND(ISTEXT(B4),NOT(B4="")),AND(ISTEXT($B$1),NO T($B$1=""))),
==TRUE
IF($B$1="IS_weap_list",
==#NAME?
IF(HasFormula(VLOOKUP(B28,IS_weap_table,MATCH("Dam ",IS_weap_head,0),0)),
==TRUE
UseSameAs(VLOOKUP(B28,IS_weap_table,
MATCH("Dam",IS_weap_head,0),0)), ==NAME?
VLOOKUP(B28,IS_weap_table, MATCH("Dam",IS_weap_head,0),0)),
==NAME?
IF(HasFormula(VLOOKUP(B28,CL_weap_table,
MATCH("Dam",CL_weap_head,0),0)), ==#VALUE!
UseSameAs(VLOOKUP(B28,CL_weap_table,
MATCH("Dam",CL_weap_head,0),0)), ==#VALUE!
VLOOKUP(B28,CL_weap_table, MATCH("Dam",CL_weap_head,0),0))),
==#N/A
"")
==""

The functions HasFormula, and UseAs are UDFs from
http://www.mvps.org/dmcritchie/excel/formula.htm They are inserted in their
own module.
The result of the formula is #Value

The following data is in the cells referenced.
B1 = IS_weap_list
B28 = ER Large Laser
The lookup retuns a formula under "Dam"

The formula:
=IF(ISTEXT(B5),
IF($B$1="IS_weap_list",VLOOKUP(B5,IS_weap_table,MA TCH("Dam",IS_weap_head,0),0),
IF($B$1="CL_weap_list",VLOOKUP(B5,CL_weap_table, MATCH("Dam",
CL_weap_head,0),0),"")),"")

Returns the proper value of 8


--

Dave Peterson