Closed Thread
Results 1 to 2 of 2

INDEX function works in cell but not in VBA

  1. #1
    Registered User
    Join Date
    02-27-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2010
    Posts
    6

    INDEX function works in cell but not in VBA

    Hello all,

    I've been working on a payroll program for my small biz. I'm close to done BUT...
    When I use the Index Match function in a cell it works great. However I need to copy it down a column to work for pay periods going forward. When I copy it down of course it puts zeros or N/A.

    Columns:

    Gross Fed FICA Medicare State Net
    F G H I J K


    Gross is user input. FICA Medicare State and Net are simply calculated on the sheet. But to get Fed Income tax I use the Index Match function and it works perfectly. The rows increment properly with each new user input.


    Code:
    =INDEX(SingleWH!C$6:M$140,MATCH(G7,SingleWH!A$6:A$140,1),MATCH(E$1,SingleWH!C$4:M$4,0))This is the code in Column F. You can see where it uses the result in Column G to look for a value in sheets("SingleWH").

    My question: Fed Income tax is dependent on what the Gross is in order to look up the tables with the Index Match function. How do I get the result of the function into column G? Can I increment up Column G and ignore the zeros that dragging the function down G creates?

    I'm sure there are other ways to do what I need as well.


    Any and all input would be greatly appreciated by this brand new VBA guy.

  2. #2
    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,946

    Re: INDEX function works in cell but not in VBA

    Welcome to the Forum, unfortunately:

    Probably a server hiccup, but...

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    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

Closed 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