LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Code to Assist with Nested Function, Also Using ISERROR

My code has a function that equates to Lotus 123's XINDEX function; it works
fine. I need to use the ISERROR with the formula in the cell that uses this
function tho, so that when an error is returned, the cell shows blank; but
when I add it, it goes over the 7 nested function limit. Note: This formula
is in a cell that will also need to be copied and pasted down the column, so
the formula references have to change (i.e., it is not a one cell thing that
I could break up with a range name for example). The code for the XINDEX
function is:

Public Function xIndex(vRange, vRowVal, vColVal)
On Error GoTo xIndexErr
Application.Volatile
With Application.WorksheetFunction
xIndex = .Index(vRange, .Match(vColVal, vRange.Columns(1), 0),
..Match(vRowVal, vRange.Rows(1), 0))
End With
Exit Function
xIndexErr:
xIndex = CVErr(Err)
End Function

My formula is:
=IF(P12=5,"",IF(M12=9,AU12,IF(M12=10,xINDEX(SMB,M1 2,H12),IF(M12<5,xINDEX(SNT,M12,H12),IF(M12<9,xINDE X(SNTOS,M12,H12),IF(M12<15,xINDEX(IPS,M12,H12),xIN DEX(IPSOS,M12,H12)))))))
The cell references in M and H will change as the formula is copied down the
column; it also has range names (SMB, SNT, SNTOS, IPS, and IPSOS) that tell
Excel where to look up the data.

Is there a way to adjust the VB code for the function so that if the formula
returns an error message, the cell shows blank? Or is there a better way to
do this? Thanks for any thoughts/suggestions.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
iserror and ifs nested formulas Vicki Excel Worksheet Functions 4 June 4th 10 09:34 PM
nested formulas in excel using iserror and if Vicki Excel Discussion (Misc queries) 2 June 4th 10 08:13 PM
nested IF(ISERROR()) statement DC Excel Discussion (Misc queries) 13 May 31st 07 01:28 PM
Iserror nested within a conditional vlookup Dale Excel Worksheet Functions 3 January 5th 07 10:40 PM
Help: Nested If/And Function formula to VB code RAP Excel Programming 2 August 9th 05 05:39 AM


All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"