+ Reply to Thread
Results 1 to 16 of 16

Multiple Lookups in Same Cell - PLEASE HELP :(

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Exclamation Multiple Lookups in Same Cell - PLEASE HELP :(

    Not sure which function I should be using as I believe VLOOKUP has its limitations with my issue.

    Here's the problem I'm having. I'm totaling the time a specific tool is used in making a specific pastry. Below is my table;

    Apple Pie
    Step#_Description___Time(min)
    1____Make Dough___9
    2____Insert Apples__8
    3____Mix Together__7
    4____Bake_________20
    5____More frosting__10

    I then, for instance, I want to see how many minutes my spatula was used in the Apple Pie process, so I place a vlookup function that will look like: "
    Tool________UsedinSteps____Minutes used Total "
    Spatula______1,2,5_________(vlookup fnct. here)

    I told the VLOOKUP function to look in the cell to the left ( A COLUMN where the 1,2,5 are) and find the 1 in the table and spit out the 9min time, that I can do. Now, I didn't know how to tell vlookup how to find step 1 and step 2 and step 5 and add their totals (in this case 9min+8min+10min) and spit out 27min under the "minutes used total" column. This is where I am lost, can VLOOKUP (or should I be using another function) search for two or more different items/values(in this case step#) and then find the corresponding values and sum the results together, can it see the comma Delimitor ??? At the moment I have "vlookup___&" / "&vlookup___ ..."and that gives me back "9 / 8 / 10" but I cannot add that together because it sees it as one number. If anyone can point me in the right direction I would GREALTY sppreciate it, perhaps I'm using the incorrect function? Please let me know. Thanks in advance guys!

    -J
    Last edited by cronerd; 06-06-2013 at 01:16 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Pie Example.xlsx Here is my example

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Here, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note: works for maximum 1 to 10 jobs
    Last edited by zbor; 06-07-2013 at 01:24 AM.

  5. #5
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Great worked perfectly! Hvala! So if I were to need more than 10 jobs in the future is there a way to tweak it to read two digit numbers?

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    You could use job starting from 10 (and not from 1).
    That way you will be able to handle jobs with this formula from 10 to 99.
    Or if starting job is 100 you can use jobs from 100 to 999.

    Problem is here when you searching job 2, for example it will give you wrong result for 32, or 52,

  7. #7
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    okay I see. I guess that is a problem since I will be using it for more than 20 steps so I will have a 11 and a 21 etc. Is there a better alternative, I'm assuming the search function can only read one digits numbers and not 2 digit numbers next to each other?

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Here's a way to do it with a UDF (User defined Function)
    I am just learning VBA so can't vouch for it's ruggedness but this seems to work

    Open up the VBA Editor (ALT + F11)
    Insert a module
    Paste this code in
    Please Login or Register  to view this content.
    Then in D12 for example
    =SumTime(C12)
    See attachment
    Questions?

    EDIT: Note the VLOOKUP range is in the code. You will need to change this to match your workbook.
    Attached Files Attached Files
    Last edited by ChemistB; 06-11-2013 at 04:26 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  9. #9
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    THANKS CHEMISTB this is right on the money!! My last question would be, since I have multiple sheets and each sheet has its own steps, i.e. 1-15 therefore there will be multiple step 1's 2's 3's etc. throughout the workbook. Is there any way of having this UDF per page rather than per document. I assume that I cannot use range A3:A240 for instance because how would it know which step1 for instance to sum?

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    I believe it would work for the active sheet. The issue is that you need to go into the formula (select the cell, F2, ENTER) to make it recalculate. Not sure if there's an easier way to do that.

  11. #11
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Any idea why it is returning a 0.00 when it should be pulling a time of .10 My times are in deimcal format so I need to input them as .10, .20 etc. Does this pull decimal format times?

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Good question. I can't see why it wouldn't but it doesn't. I'll see if a VBA guy can look at this.

  13. #13
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    You could do that with formula but you would need be careful:

    While 1st solution (1-9 jobs) return correct result no matter do you enter jobs 1,2,4 or 1, 2,4,

    With 2nd solution you MUST put COMMA then SPACE between ALL jobs within one cell. Like this: 1, 11, 21, 4
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    That worked perfectly brate!!

    If I decide to use that formula later to find a ID# rather than a number (1,2,3) would it be able to read the ID# if they look something like "WF-440-87H6"?

  15. #15
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    Quote Originally Posted by ChemistB View Post
    Here's a way to do it with a UDF (User defined Function)
    I am just learning VBA so can't vouch for it's ruggedness but this seems to work

    Open up the VBA Editor (ALT + F11)
    Insert a module
    Paste this code in
    Please Login or Register  to view this content.
    Then in D12 for example
    =SumTime(C12)
    See attachment
    Questions?

    EDIT: Note the VLOOKUP range is in the code. You will need to change this to match your workbook.
    What if I need to look into a merged cell, would I still put 3 or would I put 3&4? Does a merged cell even work then?

  16. #16
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Multiple Lookups in Same Cell - PLEASE HELP :(

    It will work but I won't suggest you merged cell. 3 is 4th column (0,1,2,3). So if you have merged 3rd and 4th column you need to put 2.

+ 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