+ Reply to Thread
Results 1 to 13 of 13

Create formula with multiple values.

  1. #1
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Create formula with multiple values.

    I need to create a formula that will allow me to use two sheets within the same workbook. I set up a dropdown box in my B2 cell in my first worksheet. My A4 cell is where I am trying to create my formula. I am not even sure how to say what I need. My drop down is filled with numbers from 1-211. I started my formula with =IF(B2=1,Sheet2!B3) this much I can get to work. It fills in the correct information. I do not know how to get it to continue. I need B2=2,Sheet2!B4 etc...... Can someone help me. If you need more information please let me know.

  2. #2
    Registered User
    Join Date
    01-24-2009
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    61

    Re: I need to create a formula with multiple values.

    instead of using if u could use vlookup function, guess that would more serve the purpose...

  3. #3
    Registered User
    Join Date
    01-24-2009
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    61

    Re: I need to create a formula with multiple values.

    can u post a sample workbook??

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: I need to create a formula with multiple values.

    Hi Cristi, welcome to the forum

    This can be done with an index

    A4: =INDEX(Sheet2!$B$2:$B$211,B2,1)

    Or with offset (same result)

    Explination: From a range B2:B211 on sheet 2 it will take the B2th (value in B2) row and the first column as there is only one column.
    Last edited by rwgrietveld; 02-26-2010 at 12:03 PM.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: I need to create a formula with multiple values.

    Okay I created a generic sample of what I am trying to do. I have my dropdowns also. On the second sheet you can see what pad number goes with which serial number or so to speak.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: I need to create a formula with multiple values.

    right the first time. Put this in A4: =INDEX(Sheet2!B2:B211,Sheet1!B2,1)
    Last edited by rwgrietveld; 02-26-2010 at 12:10 PM.

  7. #7
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Create formula with multiple values.

    That worked great Ricardo. But I should have been a little clearer. The formula works up to 100 but my list doesn't go 1-211 completely. It is 1-100 then starts back up from 181-211. I have been playing with your formula to get it to work but it will only pull 1-100 and once I click on 181-211 it doesn't bring anything back.

  8. #8
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Create formula with multiple values.

    Maybe this,

    =INDEX(Serial,MATCH(B2,Pad,0))

    Regards

  9. #9
    Registered User
    Join Date
    01-24-2009
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    61

    Re: Create formula with multiple values.

    with due respect to the others suggestions,

    A4: =INDEX(Sheet2!$B$2:$B$211,B2,1)
    as well
    =INDEX(Serial,MATCH(B2,Pad,0))
    the index function will not work since the index function picks up the data by reference to a row and a column. the above formula gives the row number to pick the data, meaning if the cell b2 in sheet 1 is 10, the function picks up data from the 10th row starting from the selection range. incidently, the range is from b2:b211. hence the 10th row from b2 is b11. hence u got the result. however when b2 is changed to 181 the 181st row from the selection range has no data!!

    vlookup function would be the apt for this solution.
    =VLOOKUP(B2,Sheet2!$A$2:$B$19,2)
    i have attached your sample workbook reworked, please refer. hope it solves ur issue.
    Attached Files Attached Files
    Last edited by navwelch; 02-27-2010 at 02:10 AM.

  10. #10
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Create formula with multiple values.

    I would still use the match (IMHO)
    I would like to add that the names could be
    Pad: =OFFSET(Sheet2!$A$2,0,0,COUNTA(Sheet2!$A:$A),1)
    Serial: =OFFSET(Pad,0,1)
    Location: =OFFSET(Pad,0,2)

    A4: =INDEX(Serial,MATCH(B2,Pad,0),1)
    C2: =INDEX(Location,MATCH(B2,Pad,0),1)
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Create formula with multiple values.

    Quote Originally Posted by navwelch View Post
    the index function will not work since the index function picks up the data by reference to a row and a column. the above formula gives the row number to pick the data, meaning if the cell b2 in sheet 1 is 10, the function picks up data from the 10th row starting from the selection range. incidently, the range is from b2:b211. hence the 10th row from b2 is b11. hence u got the result. however when b2 is changed to 181 the 181st row from the selection range has no data!!
    That's why I sugested the use of Match. Have you try the formula I provided?

    =INDEX(Serial,MATCH(B2,Pad,0))

    The Serial and Pad names are already created on the Christi.Scott original file.

    Regards

  12. #12
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Create formula with multiple values.

    Fully agree sailepaty,

    Just adjusted the named ranges as then these are more dynamic.

    The rest is the same as your approach which was OK.
    Last edited by rwgrietveld; 02-28-2010 at 06:07 AM.

  13. #13
    Registered User
    Join Date
    01-24-2009
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    61

    Re: Create formula with multiple values.

    hi sailepaty,

    i fully agree with your point. i actually wanted to add only
    A4: =INDEX(Sheet2!$B$2:$B$211,B2,1
    as not workable, but u know in a haste to provide a correct ans(out of enthusiasm having found one!!) included yours too

    infact index-match function is better than vlookup since with index-match we can get data even from the column which is to the left of the reference cell, which is not possible from vlookup.

    with respect to rwgrietveld,
    can you please tell the benefit of dynamic range in this problem

+ 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