Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Compare tabs using Double Lookup, in VB code

Hello Experts,
This is an effort to speed things up. I am using 248 out of a possible
256 columns, and 150 rows down...and it's slow. Each cell in my
"Master" tab has this long formula, starting from D5 down and across.
It compares the "Current" tab with the "Previous" tab and produces a
result. Is there a way to convert this formula to code so that it'll
run faster?

This formula is from cell [D5]:
=IF(ISBLANK(A5),"",
IF(OFFSET(CurrentBase,MATCH($A5,CurrentUnitList,0) ,MATCH(D$1,CurrentDate
Header,0))OFFSET(PreviousBase,MATCH($A5,PreviousU nitList,0),MATCH(D$1,P
reviousDateHeader,0)),"Y",
IF(OFFSET(CurrentBase,MATCH($A5,CurrentUnitList,0) ,MATCH(D$1,CurrentDate
Header,0))<OFFSET(PreviousBase,MATCH($A5,PreviousU nitList,0),MATCH(D$1,P
reviousDateHeader,0)),"X","")))

Formula Interpretation:
CurrentBase is cell A1 of the "Current" tab
CurrentUnitList is cell A2:A150 of the "Current" tab
CurrentDateHeader is cell B1:IN1 of the "Current" tab
PreviousBase is cell A1 of the "Previous" tab
PreviousUnitList is cell A2:A150 of the "Previous" tab
PreviousDateHeader is cell B1:IN1 of the "Previous" tab

In the "Master" tab,
If [A5] is blank, then leave the cell empty.
If not;
Perform a double lookup by row [A5] and by column [D1] as the search
criteria.
Go to "Current" tab and get the intersect.
Go to "Previous" tab and get the intersect.
If the "Current" intersect is "Previous" intersect then the result is
"Y".
If the "Current" intersect is < "Previous" intersect then the result is
"X".
If the "Current" intersect is = "Previous" intersect then the result is
"" [blank cell].

Thank-you in advance you, the geniuses, that come to my rescue.

Ricky

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Compare tabs using Double Lookup, in VB code

Ricky

there's lots of different ways. but i'm not sure
the using code is going to speed it up.

In general VBA functions are lot slower that worksheetformulas.
and a more efficient formula might well do the trick better.
it depends on a lot of factors.

First i suggest that you add a extra column and an extra row.
Get the indexes THERE, then point the rest of the formulas to those
indices and extract from PrevSheet with a simple
=INDEX(prevsheet!BigRANGE,b5,e2)

if you want then zip and email to address below.
so i can have a look myself.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Ricky Pang wrote:

Hello Experts,
This is an effort to speed things up. I am using 248 out of a possible
256 columns, and 150 rows down...and it's slow. Each cell in my
"Master" tab has this long formula, starting from D5 down and across.
It compares the "Current" tab with the "Previous" tab and produces a
result. Is there a way to convert this formula to code so that it'll
run faster?

This formula is from cell [D5]:
=IF(ISBLANK(A5),"",
IF(OFFSET(CurrentBase,MATCH($A5,CurrentUnitList,0) ,MATCH(D

$1,CurrentDate
Header,0))OFFSET(PreviousBase,MATCH($A5,PreviousU nitList,0),MATCH(D

$1,P
reviousDateHeader,0)),"Y",
IF(OFFSET(CurrentBase,MATCH($A5,CurrentUnitList,0) ,MATCH(D

$1,CurrentDate
Header,0))<OFFSET(PreviousBase,MATCH($A5,PreviousU nitList,0),MATCH(D

$1,P
reviousDateHeader,0)),"X","")))

Formula Interpretation:
CurrentBase is cell A1 of the "Current" tab
CurrentUnitList is cell A2:A150 of the "Current" tab
CurrentDateHeader is cell B1:IN1 of the "Current" tab
PreviousBase is cell A1 of the "Previous" tab
PreviousUnitList is cell A2:A150 of the "Previous" tab
PreviousDateHeader is cell B1:IN1 of the "Previous" tab

In the "Master" tab,
If [A5] is blank, then leave the cell empty.
If not;
Perform a double lookup by row [A5] and by column [D1] as the search
criteria.
Go to "Current" tab and get the intersect.
Go to "Previous" tab and get the intersect.
If the "Current" intersect is "Previous" intersect then the result

is
"Y".
If the "Current" intersect is < "Previous" intersect then the result

is
"X".
If the "Current" intersect is = "Previous" intersect then the result

is
"" [blank cell].

Thank-you in advance you, the geniuses, that come to my rescue.

Ricky

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply
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
Variable Lookup/Double Lookup Ryan[_2_] Excel Worksheet Functions 8 May 14th 07 09:44 PM
recognizing double digit numbers in code DB Excel Discussion (Misc queries) 3 March 2nd 07 04:43 PM
compare two data on two tabs mdavison Excel Discussion (Misc queries) 0 November 16th 06 08:42 PM
Printing two tabs of the same worksheet to one double-sided page Jennifer Excel Discussion (Misc queries) 1 April 13th 06 07:17 PM
Compare two tabs and only show exceptions Rich Excel Discussion (Misc queries) 3 June 15th 05 02:32 PM


All times are GMT +1. The time now is 12:32 AM.

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"