+ Reply to Thread
Results 1 to 11 of 11

Replace string crashes Excel

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Replace string crashes Excel

    I have a formula in almost every sheet of my workbook in the range L18:N190 (so thats 522 of the below formulas) Now I have currently have 29 sheets with these 522 formulas in them and I need to change the below filename from Sublog.xlsx to Sublog.xlsm (as it is now a macro enabled file) but using the bog standard CRTL + H method crashes excel ( i am assuming a memory issue)

    Is there any way to write a macro that could do this more efficiently?

    =IF(OR($F18="New",$A18=""),"",IF(ISERROR(VLOOKUP($AI18,[Sublog.xlsx]Page1_1!$A$3:$AN$8000,38,FALSE)),"",VLOOKUP($AI18,[Sublog.xlsx]Page1_1!$A$3:$AN$8000,38,FALSE)))

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Replace string crashes Excel

    Hi, try to edit links in the workbook i.e. Data tab->Connections group->Edit Links
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Replace string crashes Excel

    still takes forever and a day! and now it has crashed...

    also I may also want to be able to use the macro to change other things on a workbook scale, not just links but also cell refs etc.

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Replace string crashes Excel

    I think this formula is not so efficient. Also, I do not understand why you have this in 3 columns when all column references in the formula are fixed?

    You may try:

    =IF(OR($F18="New",$A18=""),"",IFERROR(INDEX([Sublog.xlsm]Page1_1!$AL$3:$AL$8000,MATCH($AI18,[Sublog.xlsm]Page1_1!$A$3:$A$8000,0)),""))

    If you do return different columns from the Sublog workbook, it will be better to put the MATCH formula into its own column.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  5. #5
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Replace string crashes Excel

    The only difference in my formulas for each colomn is the colomn they are Vlookuping in the Sublog. So the formula in colomn L looks up COL 38, M looks up COL 33 and N COL 35

    I am not familiar with using the match formula....how does it differ from mine?

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Replace string crashes Excel

    Your formulas refer to almost 320,000 cells in a different workbook but only need 16,000.

    It will be better to use a separate column for MATCH - let us assume column O:
    O18: =IF(OR($F18="New",$A18=""),"",IFERROR(MATCH($AI18,[Sublog.xlsm]Page1_1!$A$3:$A$8000,0),""))

    then you may use:
    L18: =IF($O18="","",INDEX([Sublog.xlsm]Page1_1!$AL$3:$AL$8000,$O18))
    M18: =IF($O18="","",INDEX([Sublog.xlsm]Page1_1!$AG$3:$AG$8000,$O18))
    N18: =IF($O18="","",INDEX([Sublog.xlsm]Page1_1!$AI$3:$AI$8000,$O18))

  7. #7
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Replace string crashes Excel

    A little confused by your post above. Not to say your formula doesnt work but I do not understand it. What is your first formula returning exactly (the match one). As I read it, it says if Col F is New, A is blank do nothing - else match AI18 with Col A of the sublog and then returning what...? The formula currently returns a row reference that is CLOSE to but not quite the row it should be matching, or is that just a coincidence?

  8. #8
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Replace string crashes Excel

    ah i see why the rows arent coming back right. My data starts at row 6 in the sublog...

  9. #9
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Replace string crashes Excel

    It does not return row number - it returns position within rows 3 to 8000 where match is made. So if match is in row 3, formula will return position 1.

  10. #10
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Replace string crashes Excel

    OK i see. thanks, i have used your original formula, my spreadsheet is so complicated already with many other workbooks relying on my structure to remain intact. But by using your first match formula you have reduced the size of my workbook by 40%!

  11. #11
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Replace string crashes Excel

    You are welcome.

+ 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. For loop crashes Excel when filling a cell range with string value
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2013, 09:41 AM
  2. find and replace crashes when value is not present.
    By patchypich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2011, 07:09 PM
  3. Excel - Find & Replace text in a string
    By bklim in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-14-2005, 02:37 AM
  4. [SOLVED] How do I replace * as a character in a string in Excel?
    By nicolegt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2005, 07:06 AM

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