+ Reply to Thread
Results 1 to 17 of 17

INDEX & MATCH = "#NAME?" Error.

  1. #1
    Registered User
    Join Date
    01-28-2011
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    INDEX & MATCH = "#NAME?" Error.

    Hello again. I've change the argument format on my "Sub TaskDescription()". It works, except that it keeps repeating the first value throughout the whole column. HOWEVER, the same formula WORKS PERFECT on a REGULAR EXCEL CELL. All suggestions are welcome. Thanks.
    This is my new Sub:
    Please Login or Register  to view this content.
    Hi There. I'm developing a project. Trying to match my "ScopeOfWork
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by excelV3; 01-15-2014 at 09:27 PM. Reason: UPDATING WORKBOOK.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi,
    Try this :
    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    Newcastle, Australia
    MS-Off Ver
    2003, 2010
    Posts
    54

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi excelV3

    Just opened your file.
    I don't know if you are aware your code-block in the initial post is ... is ... difficult to read. Especially the last few lines of code.
    Obviously EstimateMatrixRun() sub is public, but do all the called subs need to be public ?

    I need to comment out your code in the Excel file so I know what is happening and where and by whom.
    (I will PM it back to you so you can see my commenting regime. The benefit of comments is another person can take over the project, and get a grasp of what is what, and for. It can be very frustrating in two years time when you return to your project and don't remember how the project code works.

    So far I have established the "#NAME?" error (in each cell) is a "string" not the result of a cell formula error.
    If VBA encounters a cell error the VBA error (for #NAME? cell error) is VBA "Error 2029" (a string, for which VBA offers no easy help) which in turn, when the code trips up later in the code, returns VBA Err(1004) which is a generic number for invalid objects (named range, worksheet, comments, images ) or at worst "we (vba) don't know" (VBA can be very unhelpful sometimes)

    Until I can sort through your project I cannot give you a definitive answer.
    There is also a lack of variables ... to evaluate, with all direct assignments into ranges.
    In the meantime ...

    Let us know if you resolve it yourself and I will get back here when I have something myself.

    Last edited by GreyGhost; 01-15-2014 at 01:38 AM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,969

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi and welcome to the forum

    You had [code tags inside your CVA code, so the code tags didnt work properly - i removed them for you
    Last edited by FDibbins; 01-15-2014 at 02:06 AM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    01-28-2011
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: INDEX & MATCH = "#NAME?" Error.

    Hello GC Excel. I tried just like you suggested, and I'm getting:

    "=INDEX(TaskDescription[TASK DESCRIPTION],MATCH([CODE],TaskDescription ,0))" AS TEXT ON MY FORMULA CELL.

    So I don't think it is a good sloution. Please let me know y you think of something else.

    I really appreciate your time.

  6. #6
    Registered User
    Join Date
    01-28-2011
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: INDEX & MATCH = "#NAME?" Error.

    Thanks FDibbins. I really appreciate it.

  7. #7
    Registered User
    Join Date
    01-28-2011
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: INDEX & MATCH = "#NAME?" Error.

    Hello GreyGhost. Someone helped me out to fix my post. Please keep my project in mid. I'll be cheking on your posting. Of course, I'll let you know if I can figure it out.
    Talk to you soon.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: INDEX & MATCH = "#NAME?" Error.

    Try this.
    HTML Code: 
    That will give results in the TASK DESCRIPTION column, no idea if they are the right results though

    PS The code is in HTML tags, instead of CODE tags, because the formula uses [CODE] for the column name in the table ScopeOfWork.
    Last edited by Norie; 01-15-2014 at 07:23 PM.
    If posting code please use code tags, see here.

  9. #9
    Registered User
    Join Date
    06-09-2011
    Location
    Newcastle, Australia
    MS-Off Ver
    2003, 2010
    Posts
    54

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi excelV3

    I just worked your problem out, using a totally different approach.
    And it works perfectly
    I have 10 minutes to get to the dentist. I will post you again when I get back.

    GreyGhost

  10. #10
    Registered User
    Join Date
    01-28-2011
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: INDEX & MATCH = "#NAME?" Error.

    I came out with the same solution. It works, half-way do. It keeps repeating the first value throughout the column. However, the same formula on a regular EXCEL CELL works perfect. I'm posting the updated version of my worksheet. Can you please take a look at it?. thanks.

  11. #11
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi,
    Here's an other suggestion :
    HTML Code: 
    Attached Files Attached Files

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: INDEX & MATCH = "#NAME?" Error.

    excelV3

    Which solution are you referring to in post #10?

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: INDEX & MATCH = "#NAME?" Error.

    Actually ignore that, GC Excel's last suggestion works and I don't think you can do it any other way.

  14. #14
    Registered User
    Join Date
    06-09-2011
    Location
    Newcastle, Australia
    MS-Off Ver
    2003, 2010
    Posts
    54

    Re: INDEX & MATCH = "#NAME?" Error.

    Hi excelV3

    Your modified file is attached.
    two versions
    1. Clean version with expression comments
    2. Dirty version containing all the left over crud (expression tests etc) for you to look at if you want to.

    All modules are headed with "Option Explicit" which is a must
    I have abandoned the use of worksheet functions in VBA, just too clunky and hard enough to follow for anyone.
    The form combobox is filled with an array, based on the "Tasks" table.
    I have included an eNum statement (instead of numeric constants) to represent each column in the "Scope" table.
    New added item details (3 fields) are now added by the OK btn on the form, instead of your previous arrangment.
    Would have been problematic if form is cancelled (unloaded) and Item-ID is populated but not the other 2 fields
    The combo box contains a 2 column list -- and will auto accommodate any added tasks in the future.

    In fact I rewrote the entire project including copious expression notes.
    Anything you are not clear on, post back here in this thread
    Sorry about the delay (dentist was heavy duty)

    Regards,
    GreyGhost

    FINISHED.zip

  15. #15
    Registered User
    Join Date
    06-09-2011
    Location
    Newcastle, Australia
    MS-Off Ver
    2003, 2010
    Posts
    54

    Re: ... an ALTERNATIVE APPROACH without using WorksheetFunctions

    For the benefit of other (excelV3) has the "improved files"
    - does not use WorksheetFunctions
    - populates new data sheet all from form in one process, not two processes as in excelV3 original.
    - traps nothing selected in combobox list.
    - fills combo with an array to populate target data sheet with two values for new record
    ** LOTS of expression comments for newbies **

    UserForm code
    - two macros/procedures
    - form has one Label, one ComboBox, one CommandButton
    Please Login or Register  to view this content.
    One standard module
    - one sub procedure + one private function ... instead of 7 Sub procedures
    - uses Enum statement for numeric (integer) Constants, (ie, Column numbers on Target worksheet)
    - public variables used by form "Button_Click()" to populate target row

    Please Login or Register  to view this content.
    Last edited by GreyGhost; 01-16-2014 at 10:13 PM. Reason: corrections

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: INDEX & MATCH = "#NAME?" Error.

    GreyGhost

    Was there some problem caused by subs being public instead of private?

  17. #17
    Registered User
    Join Date
    06-09-2011
    Location
    Newcastle, Australia
    MS-Off Ver
    2003, 2010
    Posts
    54

    Public macros vs Private macros

    Hi Norie

    I have couched this reply for the benefit of newbies too, so my respectful acknowledgment to experienced Excel coders.
    For the purests I have used the familiar term macro in place of tech-talk procedure

    Quote Originally Posted by Norie
    Was there some problem caused by subs being public instead of private?
    No problems but not good coding practice.
    All macros in a project are "remembered" in hierarchical order. If all macros are public, VBA has to look through the list of all macros in the project. But if a macro calls a private-macro on the same module, VBA only has to find the private macro on the module and not look through the entire list of all macros in the project.
    • Similar to the tree structure in "Windows Explorer" ...
      ... it is easier to find a file when you know which folder it is in rather than one folder with a zillion files on a massive list.
      With sub folders you can also have files with identical names in different folders
    -----
    TERMINOLOGY:-
    Scope = extent of availability in the project
    Public (scope) = project wide, the workbook
    Private (scope) = limited to the module

    -----
    For memory there were 7 project scope Subs on the standard module.
    One Public macro was all that was necessary for the sheet button.
    Calling other public subs containing one expression hinders the efficient run-times/efficiency of the project.
    The slave macros were used as module scope (only called by the button-macro) and should have been "Private" limited to the module.
    Conversely one massive macro stuffed with everything is not easy to test either. It is a case of balance.
    eg, the "Private Function fnContinue()" in second code-block in post #15 is self contained resolution to a specific single outcome ... also made reading the primary public macro easier to interpret.
    Please Login or Register  to view this content.
    Project scope (Public) macros on standard modules ...
    1. we cannot live without them (almost:- there are exceptions)
    2. Increase the file size (not a significant problem on this very small project)
    3. with fewer Public macros the project will run faster (not very noticable in a 35KB project, but makes a difference in big projects)
    4. Restricts the ability to use the same macro name on other standard modules in the project.
    5. With multiple projects open, if all macros in all projects are public the Macros list can be very crowded with macros from other projects.
      Granted other project macros are listed as eg, "[MyBook.xls]mymodule.my_macro"
      It is best practice to only have essential procedures (Subs, Functions) as "Public"
    6. Controls on addin toolbars use project scope macros.
      If there are two or more projects open (eg, an xls and xla) files with identically named macros the xla toolbar control will not run any macro.
      XLA macros (session scope) have precedent over an individual XLS (xlsm) project scope macro, so in theory an XLS control can run an invisible XLA macro of the same name.
      Very confusing to the user, because only the xls project macro is listed on the macros dialog, but infact the xla macro is also "available"
      Excel's solution with identical macro names is to do nothing. Which leaves the user in bewilderment, "why doesn't the macro run?".
      (And yet the xls macro will run from the Macros list but not by any sheet controls.
      (In addins I name all public macros with a trailing identifier, eg, "MyToolbarControlMacro_18Jan2013" to save clashing with other projects (xls and xla))


      Most basic users may never encounter the problem, but it is possible.
    7. As all public macros on std modules are listed on "Macros" dialog/list any user can run them, and to an inexperienced user the consequences might be catastrophic. (ie, an unhandled error)
    =====
    Macros can be hidden on the Macros dialog by adding the statement "Option Private Module" at the top of a standard module before any variable/constant declarations
    Option Explicit
    - a must on all modules (form-class and standard modules)
    - VBA does not have to guess at the data type of variables and constants (guessing slows run time)
    Option Private Module
    - Hides macros on "Macros" dialog, but does not impeded the availability of the macro
    - Only on standard modules, never on Classes (userform) otherwise a compile error at run-time.

    Please Login or Register  to view this content.
    =====

    Then there are addins; Class Modules (of which UserForm is a Class); Property procedures; eNums ... and ActiveX controls on worksheets
    ... fun for another day and place !

    GreyGhost

+ 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. Issue using Index/Match to pull multiple occurrences of "Match" criteria
    By aridfriedman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2014, 11:38 AM
  2. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  3. Replies: 7
    Last Post: 04-11-2013, 12:46 AM
  4. Strings Variables in Range("A1").Formula = "=index/match" ?
    By nadnerb5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2012, 05:07 PM
  5. [SOLVED] Variable "sheet-name" and "range-name" wanted in INDEX/MATCH-function
    By Fiebuls in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2012, 04:09 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