+ Reply to Thread
Results 1 to 6 of 6

Insert Pay Rate Based On Employee Selected

  1. #1
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Insert Pay Rate Based On Employee Selected

    I have a pretty basic spreadsheet set up to calculate payroll for some of our temporary workers. I have a table of workers names and their pay rates in the lower right hand side of my worksheet.

    Up until now I have been glancing over to determining their pay rate and manually entering that rate into a specific cell (I2) to start the pay calculations. What I would like to do is somehow add another column to the left of their names and place an "x" or something in that column for the specific employee I am calculating. Once the "x" is placed there I would conditionally format the employees name to be highlighted and have their wage entered into cell I2.

    So what I need is a formula to enter into cell I2 which searches cells K5:K24 and when it finds an "x" it enters the payrol rate from the corresponding cell in the range of N5:N24

    I know I could revamp my spreadsheet and make a drop down list of names and when a name is selected do a vlookup for the pay rate, but I am looking for a different and hopefully simpler solution.

    Thanks, Spence
    Last edited by Spencer; 02-06-2009 at 03:53 PM. Reason: Follow Up Question

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Pay Rate Based On Employee Selected

    You don't need to do the "x" thing. This is a standard VLOOKUP calculation. The "x" thing wouldn't work because each "x" would cause something different to happen.

    And doing it with a macro doesn't fit my idea of "simpler", so I'd stay with VLOOKUP. It's what it's designed for.

    Names = column M
    Pay rates = column N

    Let's assume you just put a name in cell H2, to get the pay rate to appear on its own in I2, use this:

    =VLOOKUP(H2,$M$5:$N$24,2,FALSE)

    ...and copy that formula down for the rest of the names you add.

    If names aren't always in the cell already, use this version to avoid error messages for blanks:

    =IF(H2<>"",VLOOKUP(H2,$M$5:$N$24,2,FALSE),"")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Pay Rate Based On Employee Selected

    If the I2 is being used to only calculate one employee and when you're done, you copy that off somewhere and do another employee in the same spot, then how about this to match closer to your original request:

    To get the name to appear on its own in H2:

    =INDEX($M$5:$M$24,MATCH("x",$K$5:$K$24,0))


    To get the pay rate in I2, same idea:

    =INDEX($N$5:$N$24,MATCH("x",$K$5:$K$24,0))


    If more than one X is in column K, you might get weird results.

  4. #4
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Insert Pay Rate Based On Employee Selected

    Quote Originally Posted by JBeaucaire View Post
    If the I2 is being used to only calculate one employee and when you're done, you copy that off somewhere and do another employee in the same spot, then how about this to match closer to your original request:

    To get the name to appear on its own in H2:

    =INDEX($M$5:$M$24,MATCH("x",$K$5:$K$24,0))


    To get the pay rate in I2, same idea:

    =INDEX($N$5:$N$24,MATCH("x",$K$5:$K$24,0))


    If more than one X is in column K, you might get weird results.
    Cutting and pasting both of those formulas worked perfectly.

    I will try to reverse engineer the logic later on, but for not I am back to work.

    Thanks,
    Spence

  5. #5
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Insert Pay Rate Based On Employee Selected

    This has been working great, a major improvement over what I was doing before. I am wondering if it would be much trouble to add radio buttons instead of the "x" that I am using.

    If anyone could point me in the right direction on that I would appreciate it.

    Thanks, Spence

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Pay Rate Based On Employee Selected

    The "x" is what you specified. You could replace that with a cell reference and whatever value is in that cell will be matched instead of Xs. You could use a radio button to control the content of that cell.

    =INDEX($M$5:$M$24,MATCH($A$1,$K$5:$K$24,0))

    INDEX(MATCH() is a standard technique. Read up on it here:
    http://www.contextures.com/xlFunctions03.html

+ 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