+ Reply to Thread
Results 1 to 2 of 2

Shorter formulae makes file 3X larger

  1. #1
    Registered User
    Join Date
    04-10-2008
    Posts
    1

    Shorter formulae makes file 3X larger

    Can anyone tell me why when I shortened the first formula below to the second formula, my file size increased 3 fold? Let me tell you a little about the file.

    It has 13 worksheets: one for every month and one to total all the months. (I recently read a post that discourages this and I think I'll try putting all 13 in one worksheet later. But first answer this please).

    Each month has 2000 rows of formulas in 10 columns. The formula below reads the code data entered in F10 and returns "ERR" unless the 4th item in the code is a number from 1 to 7, or a space bar character, or nonexistent (i.e. if the code entered is only 3 characters long).

    =IF(F10="","",IF(OR(MID(F10,4,1)="1",MID(F10,4,1)="2",MID(F10,4,1)="3",MID(F10,4,1)="4",MID(F10,4,1)="5",MID(F10,4,1)="6",MID(F10,4,1)="7",MID(F10,4,1)=" ",MID(F10,4,1)="")=TRUE,MID(F10,4,1),"ERR"))

    8 of the columns have the same basic formula (but they don't all check for a number from 1 to 8; each place in the code is limited to certain text or numbers). I know now the =TRUE is redundant.

    I changed them all to this format:

    =IF(F10="","",IF(MID(F10,4,1)=""," ",IF(OR(MID(F10,4,1)={"1","2","3","4","5","6","7"," "}),MID(F10,4,1),"ERR")))

    This formula looks shorter and more efficient, but when I replaced all the cells with this format, it increased the file size 3X! Is there an easy idea of why? I prefer a smaller file size even if the formula looks less efficient.

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,
    I don't know why the second formula triples the file size (although I suspect it may relate to the use of the array within the pinched brackets) but I do have some suggestions that may help bring it back down.

    * Check the "last cell" on each sheet by using [ctl + end]. Ideally, this will result in the last row of data being selected (eg approximately row 2000). If the last cell is further down the sheet (eg row 10,000 or as extreme as 65K+) then you will be able to minimise the file size by deleting excess formatting (using the Edit-Delete option not "delete" on the keyboard which only "clears the contents").

    thinking time...
    1) This option decreases the number of calculations completed for each cell by splitting out the duplicated equation.
    Put the below in a blank column (eg col G):
    =MID(F11,4,1)
    & put the below into the next column (eg column H)
    =IF(F11="","",IF(G11=""," ",IF(OR(G11={"1","2","3","4","5","6","7"," "}),G11,"ERR")))

    2) Similar but removes the use of an array - relies on G12 being able to be interpreted as a number.
    Put the below in a blank column (eg col G):
    =MID(F12,4,1)
    & put the below into the next column (eg column H)
    =IF(F12="","",IF(G12=""," ",IF(OR(AND(G12>0,G12<8),G12=" "),G12,"ERR")))

    or maybe
    =IF(F12="","",IF(G12=""," ",IF(OR(AND(value(G12)>0,value(G12)<8),G12=" "),G12,"ERR")))

    Also, I suggest changing the results for "" or " " to a brief phrase (depends on what the result is used for) because as it is currently written users can't differentiate between "" & " ", can they?

    I don't know if these suggestions will help but I hope they do.

    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automating Import Wizard for CSV file
    By jehanzeb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2008, 11:10 AM
  2. Excle data file and macro publishing problem
    By sujata_ghosh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2008, 04:19 AM
  3. Summarize results from files into main file
    By aktarina in forum Excel General
    Replies: 4
    Last Post: 09-06-2007, 01:09 AM
  4. Conditional saving in a given directory, with always changing file name
    By hunsnowboarder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2007, 12:26 PM
  5. Reference filename in formula
    By middlectom in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2007, 07:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1