+ Reply to Thread
Results 1 to 6 of 6

populate cell with formula referenced from array, insert adjacent cell value into formula

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    Midwest, United States
    MS-Off Ver
    Excel 2008
    Posts
    3

    populate cell with formula referenced from array, insert adjacent cell value into formula

    I'm making a worksheet to calculate the money that needs to be paid to vendors for their services.

    The services are located in Column A, titled "Vendor Services"
    Column B is titled "Number of Hours"
    Column C is "Vendor Charge"
    I want to populate Column C with the formula affiliated with the vendor service in the same row.

    So if:
    A2=Jenny, Hiking Adventure
    B2=3
    I want C2 to auto-populate with A2's affiliated formula =IF((B2>0),(B2-1)*50+85,0) because Jenny charges $85 for the first hour and $50 each additional hour.

    The resulting cell value would be C2=$185.00

    I have 30 different vendor services listed at the bottom of the sheet and I've written a formula to calculate each service. I had to add a third column in which all cells contain the number 1 because the formula to calculate the service needs a reference. This array is D30:F60.

    I've tried C2=VLOOKUP(A2,D30:F60,2,FALSE)

    This inserts a formula that calculates the price based on the number of hours (1) in column F of the array. I need the formula to calculate the price based on column B.

    How do I tell Excel to auto-populate C2 with A2's affiliated formula, using the cell value of B2 in the resulting formula?

    Many thanks in advance for you help.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: populate cell with formula referenced from array, insert adjacent cell value into form

    HI Globalfuture,

    welcome to the forum.

    Can you upload a sample workbook to support your query ? Thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    05-03-2013
    Location
    Midwest, United States
    MS-Off Ver
    Excel 2008
    Posts
    3

    Re: populate cell with formula referenced from array, insert adjacent cell value into form

    Dilipandey,

    Thanks tons for your response. Attached is a sample workbook. I'm trying to find the formula for column C. Any help you could provide is greatly appreciated.

    vr/
    Attached Files Attached Files

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: populate cell with formula referenced from array, insert adjacent cell value into form

    Not sure but if you wish to use column B to calculate charges, you can use "=VLOOKUP(A2,$D$30:$F$38,3,FALSE)*B2"

    Else manually put your expected results in column C and I'll try to obtain them using formulas. thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    05-03-2013
    Location
    Midwest, United States
    MS-Off Ver
    Excel 2008
    Posts
    3

    Re: populate cell with formula referenced from array, insert adjacent cell value into form

    Dillipandey Ji,

    Attached is version 2 of the sample workbook. As requested, I've manually placed the desired value, C2=185, into the spreadsheet. But if you'll notice in array D30:F38, I have already figured out the formulas. So you don't need to do that. However, I don't know how to populate C2 with the formula from the array such that formula in C2 uses value of B2 to calculate the answer. How do I make that happen?

    As you suggested, I tried =VLOOKUP(A2,$D$30:$F$38,3,FALSE)*B2
    This doesn't work, because it yields c2=255

    The C2 formula should be =IF((B2>0),(B2-1)*50+85,0), where B2=3. Thus, the value should be C2=185

    Any other advice?

    Vr/

    I V2_sample workbook vendor services.xlsx

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: populate cell with formula referenced from array, insert adjacent cell value into form

    I don't know how to populate C2 with the formula from the array such that formula in C2 uses value of B2 to calculate the answer.
    Though it looks like a simple task.. but I am not getting it.. even your attached workbook is not much of help. . sorry.


    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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