+ Reply to Thread
Results 1 to 18 of 18

Change all regular formulas into array formulas

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Change all regular formulas into array formulas

    Hello,

    I have a big number of cells I would like to convert into array formulas. Currently, I have to go to one by one and C+S+E. Is it possible to select a range and for the macro to automatically convert all the formulas in the selected range into array formulas?

    Thank you for your time

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    do you mean something like this
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    Hi Jospeh, thank you for the reply. I get a "Compile error: Invalid Next control variable reference error". Thank you

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Change all regular formulas into array formulas

    Next rcell or just Next
    Last edited by TMS; 06-10-2012 at 03:13 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    I apologize-it was a typo and should be 'next rcell' (I prefer not to use Next on its own)

  6. #6
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    No worries. However I still receive an error, '1004': Unable to set the FormulaArray property of the Range class. Thank you

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    how long is the formula that it fails on? there is a limit of 255 characters for the formulaarray property

  8. #8
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    Yes, this should be the problem. In all sheets the min. characters are 350 and in other sheets the characters are around 1540. Is there any possible way to overcome the limit or to C+S+E all cells? Thank you very much

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    yeah-you need to use a placeholder and then replace it. see this ddoe post: http://www.dailydoseofexcel.com/arch...rmulas-in-vba/
    I reckon your workbook is probably going to be slower than molasses going uphill in January though. ;-)

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Change all regular formulas into array formulas

    I prefer not to use Next on its own
    I tend to use just Next but with the variable commented out. I read somewhere once, a long time ago, that it was more efficient and/or unnecessary ... and I've been doing it ever since.

    Hence: Next 'rcell

    Whatever, I don't imagine it's a big deal

    TMS

  11. #11
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    Thank you for the replies. Could you please explain how I can use the code in the link for this purpose? The formulas in one sheet are 1540 characters and eaxh formula uses a different range and value. Is it possible to use the code in the link for this purpose? Thank you

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    if all the formulas are completely different, then you will have to create a formula parser and it's probably quicker to change them by hand frankly. if they are basically the same but with different ranges and comparison values, then you can probably figure out a pattern to replace.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Change all regular formulas into array formulas

    We've not seen any of your formulae or data structure. I'm guessing they're not all different. Can't you just manually convert the top row and then autofill down?

    Regards, TMS

  14. #14
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    Thank you for your replies. This is the formula I am using in one sheet (credits to NBVC for both formulas)

    Please Login or Register  to view this content.

    In another sheet I use the following formula


    Please Login or Register  to view this content.
    Both formulas address around 2000 different ranges in each sheet. So I will need to C+S+E 4000 times and drag down. If it would be possible to automate the c+s+e process it would save me a few days Thank you

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Change all regular formulas into array formulas

    it's way too early for me to even think about following that and I don't think your workbook will ever finish calculating if you have 4000 of those copied down lots of rows.

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Change all regular formulas into array formulas

    Can we see a sample of the workbook please. I'm struggling to understand the setup.

    Regards, TMS

  17. #17
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Change all regular formulas into array formulas

    I am attaching a small example. The real data go down to around 4000 thousands rows.

    You can see the formulas in AF42, AG42,AH42 ... The formulas continue for hundreds of columns, each one formula is using different ranges. If I could change all formulas in AF42, AG42,AH42 and so on, I could then drag them down to 4000 rows.

    Thank you very much for your help
    Attached Files Attached Files

  18. #18
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Change all regular formulas into array formulas

    You should probably be asking for someone to help you to perform the same task using VBA instead of using the formula. The formula wasn't meant to be copied down and/or across so many rows/columns... it will grind the workbook to a halt. You need a VBA alternate solution to perform the task and loop through the columns and rows...to return results...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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