LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 733
Default Slow Array formula or is there any alternative

"SHAWN" wrote...
....
I had troubles figuring out how to accomplish this without VBA and
Harlan Grove has kindly offered a solution to my problem, which is an
array formula, that looks like this:

{=IF(NOT(ISERROR(VLOOKUP(A6,W2Ord,1,FALSE))),
VLOOKUP(A6,W2Ord,1,FALSE),IF(A6="",INDEX(W2Ord,
MATCH(0,COUNTIF(C$5:C5,W2Ord),0)),""))}

....

That's not my formula.

You've screwed it up with VLOOKUPs that I didn't use. Note that if the
initial VLOOKUP in the IF condition doesn't return an error, THERE'S
ABSOLUTELY NO BENEFIT FROM CALLING IT A SECOND TIME! In other words,

=IF(ISNUMBER(VLOOKUP(A6,W2Ord,1,0)),A6,...)

because nonerror VLOOKUP(x,y,1,0) == x by necessity.

*IF* your W2Ord list contained only distinct numeric values sorted in
ascending order, you could use (assuming the status entry corresponding to
A6 should be in B6)

B6:
=IF(ISNUMBER(A6),IF(A6<MIN(W2Ord),"",IF(VLOOKUP(A6 ,W2Ord,1)=A6,A6,"")),
IF(B5<MAX(W2Ord),INDEX(W2Ord,MATCH(B5,W2Ord)+1),"" ))

filled down. This could be made more efficient by calculating MIN(W2Ord) and
MAX(W2Ord) in other cells and referring to those cells rather than calling
MIN and MAX in each col B formula.

If W2Ord isn't sorted or contains duplicate numeric values which shouldn't
be duplicated in the status column in the report, then the only improvement
you may be able to achieve would be something like

B6 [*array* formula]:
=IF(ISNUMBER(A6),IF(A6<MIN(W2Ord),"",IF(ISNUMBER(M ATCH(A6,W2Ord,0)),A6,"")),
IF(B5<MAX(W2Ord),MIN(IF(W2OrdB5,W2Ord)),""))

This assumes ISNUMBER(MATCH(x,y,0)) will recalc faster than COUNTIF(y,x) and
that MIN(IF(yz,y)) will recalc faster than
INDEX(y,MATCH(0,COUNTIF(.,y),0)).

If you're going to go for a programatic solution, read List2 into an array,
keep track separately of its MIN and MAX values, and sort it. Then loop
through your List1 checking its values against List2's MIN value and using
binary search to find closest matches in List2. Once the final value in
List1 has been matched, dump the rest of the stored and sorted List2 into
the cells below the last matched value. Don't just use any formula in
batches of cells.


 
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
Alternative program to Excel for array formulas Minister Excel Discussion (Misc queries) 2 August 14th 09 04:13 AM
Large array, slow calcualtion of formulas Gary Excel Discussion (Misc queries) 3 July 29th 09 02:09 PM
Returning an alternative value if lookup cannot be found in array Queen_Of_Thebes Excel Discussion (Misc queries) 4 September 2nd 08 01:43 AM
expert help needed for better alternative to slow workbook timteebow66 Excel Worksheet Functions 3 March 25th 08 07:03 AM
Using "--" as an array formula shortcut / alternative [email protected] Excel Discussion (Misc queries) 9 February 6th 08 08:48 AM


All times are GMT +1. The time now is 05:44 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"