+ Reply to Thread
Results 1 to 8 of 8

Formula Array - Nomenclature

  1. #1
    Registered User
    Join Date
    04-11-2016
    Location
    miami
    MS-Off Ver
    2013
    Posts
    5

    Formula Array - Nomenclature

    Hi,

    I'm new to VBA and need a little help.

    I'm trying to put the below Formula Array in a cell using VBA but I get an "Run-Time Error 1004 Application-Defined or object-defined error"

    =IFERROR(INDEX(Meals,(SMALL(IF(Meals[Meal]=$A$1,ROW(Meals[Meal])),ROW(1:1)))-1,2),"")

    When I put the formula in the cell and press CTRL + SHIFT + ENTER , it works fine though.

    I'm not really sure why this is happening, I'm guessing it has to do with the Table Meals? Meals is a table in another worksheet but same Workbook.

  2. #2
    Registered User
    Join Date
    04-11-2016
    Location
    miami
    MS-Off Ver
    2013
    Posts
    5

    Re: Formula Array - Nomenclature

    This is the code.

    Sub MC()

    Worksheets("Meal Calculator").Range("A1").FormulaArray = "=IFERROR(INDEX(Meals,(SMALL(IF(Meals[Meal]=$A$1,ROW(Meals[Meal])),ROW(1:1)))-1,2),"")"


    End Sub

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Formula Array - Nomenclature

    Within a string, each literal quote character is represented by two quotes.

    Worksheets("Meal Calculator").Range("A1").FormulaArray = "=IFERROR(INDEX(Meals,(SMALL(IF(Meals[Meal]=$A$1,ROW(Meals[Meal])),ROW(1:1)))-1,2),"""")"
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    04-11-2016
    Location
    miami
    MS-Off Ver
    2013
    Posts
    5

    Re: Formula Array - Nomenclature

    Wow, I can't believe that...

    Can you help me a little further? I can't quiet figure out how to get the second Integer "XXX" to loop with the first Integer "RowA".

    The loop works fine for the rowA, working its way down the list. But I can't quiet figure out how to get the Row function going from Row(1:1) to Row(20:20). Thank you in advance

    Sub MC()

    Dim rowA As Integer
    Dim XXX As Integer

    For rowA = 4 To 24 & XXX = 1 to 20


    Worksheets("Meal Calculator").Range("A" & rowA).FormulaArray = "=IFERROR(INDEX(Meals,(SMALL(IF(Meals[Meal]=$A$1,ROW(Meals[Meal])),ROW(XXX:XXX)))-1,2),"""")"

    Worksheets("Meal Calculator").Range("B" & rowA).FormulaArray = "=IFERROR(INDEX(Meals,(SMALL(IF(Meals[Meal]=$A$1,ROW(Meals[Meal])),ROW(XXX:XXX)))-1,3),"""")"

    Next rowA & XXX

    End Sub

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Formula Array - Nomenclature

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-11-2016
    Location
    miami
    MS-Off Ver
    2013
    Posts
    5

    Re: Formula Array - Nomenclature

    I can't believe that, I'm going to have to buy a book. Learning vba for dummies.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Formula Array - Nomenclature

    You're welcome.

  8. #8
    Registered User
    Join Date
    04-11-2016
    Location
    miami
    MS-Off Ver
    2013
    Posts
    5
    Quote Originally Posted by AlphaFrog View Post
    You're welcome.
    I'm driving right now I haven't checked if it works I'm pretty sure it does though thank you a lot I spent like 2 hours on that

+ 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. Replies: 3
    Last Post: 04-02-2016, 08:16 PM
  2. [SOLVED] Absolute reference with Table Nomenclature.
    By JO505 in forum Excel General
    Replies: 6
    Last Post: 03-29-2015, 06:51 PM
  3. Array formula + Array formula with criteria that lookups a Table
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2013, 11:41 AM
  4. DOS Equivalent File Nomenclature
    By SDruley in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-01-2011, 07:15 AM
  5. Replace hard coded array in formula with link to input array
    By David Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-08-2011, 07:45 AM
  6. PROBLEM: Keywords;= Userform, Class Modules, ButtonGroup and Nomenclature
    By Myles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-01-2006, 08:50 PM
  7. [SOLVED] Tricky array formula issue - Using array formula on one cell, then autofilling down a range
    By aspenbordr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2005, 11:05 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