Results 1 to 3 of 3

Long Array Formula VBA

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    Long Array Formula VBA

    I have a formula in cell Q2 as follows
    "=MIN(MIN(IF(RIGHT($G$2:$G2,LEN(G2)-FIND(""|"",G2))=(RIGHT(G2,LEN(G2)-FIND(""|"",G2))),($H$2:$H2),"""")),MIN(IF(RIGHT($I$2:$I2,LEN(I2)-FIND(""|"",I2))=(RIGHT(I2,LEN(I2)-FIND(""|"",I2))),($J$2:$J2),"""")),MIN(IF(RIGHT($K$2:$K2,LEN(K2)-FIND(""|"",K2))=(RIGHT(K2,LEN(K2)-FIND(""|"",K2))),($L$2:$L2),"""")))"
    I am trying to use this formula in VBA. I have tried
        Range("Q2").FormulaArray = _
            "=MIN(MIN(IF(RIGHT(R2C7:RC7,LEN(RC[-10])-FIND(""|"",RC[-10]))=(RIGHT(RC[-10],LEN(RC[-10])-FIND(""|"",RC[-10]))),(R2C8:RC8),"""")),MIN(IF(RIGHT(R2C9:RC9,LEN(RC[-8])-FIND(""|"",RC[-8]))=(RIGHT(RC[-8],LEN(RC[-8])-FIND(""|"",RC[-8]))),(R2C10:RC10),"""")),MIN(IF(RIGHT(R2C11:RC11,LEN(RC[-6])-FIND(""|"",RC[-6]))=(RIGHT(RC[-6],LEN(RC[-6])-FIND(""|"",RC[-6]))),(R2C12:RC12),"""")))"
        Range("Q2").AutoFill Destination:=Range("Q2:Q35"), Type:=xlFillDefault
    I have also tried
        Range("Q2").Formula = "=MIN(MIN(IF(RIGHT($G$2:$G2,LEN(G2)-FIND(""|"",G2))=(RIGHT(G2,LEN(G2)-FIND(""|"",G2))),($H$2:$H2),"""")),MIN(IF(RIGHT($I$2:$I2,LEN(I2)-FIND(""|"",I2))=(RIGHT(I2,LEN(I2)-FIND(""|"",I2))),($J$2:$J2),"""")),MIN(IF(RIGHT($K$2:$K2,LEN(K2)-FIND(""|"",K2))=(RIGHT(K2,LEN(K2)-FIND(""|"",K2))),($L$2:$L2),"""")))"
        Range("Q2").Select
        Application.SendKeys "{F2}^+{ENTER}"
        Range("Q2").AutoFill Destination:=Range("Q2:Q35"), Type:=xlFillDefault
    .

    I can't get either of these methods to work. I believe there is a 256 char limit for array formulas in VBA, which would explain why the first method won't work. Is there any workaround that might work? Thanks.
    Last edited by maacmaac; 12-27-2011 at 11:26 AM.

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