+ Reply to Thread
Results 1 to 15 of 15

VLOOKUP - to return a value based on what I input to a cell?

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    9

    Thumbs up VLOOKUP - to return a value based on what I input to a cell?

    Hi,

    I admit I know very little about vlookups. Had training on them a couple years back but haven't used one since.

    I have a list of products and sales figures. What I want is to be able to type into a cell the code of the product, and then for the vlookup to give me the sales of that product.

    Here's an example:

    A B
    1 Product Name Sales
    2 ASDF - Class 4 widget 10
    3 ASDFG - Class 4 widget with bells on 15
    4 QWER - Elbow grease 100ml 20
    5 QWERT - Elbow grease 250ml 3
    6 QWERTY - Elbow grease 500ml 5
    7 ZXC - Left handed screwdriver 7
    8 ZXCV - Right handed screwdriver 654
    9 ZXCVB - Dual hand screwdriver 311

    So - column A has products, column B sales.

    I want to type the product code (ASDF, QWERT etc) into cell C1 and have cell D1 tell me the sales.

    Any idea on the formula please?

    Best regards,

    Andy
    Last edited by AndyHawke; 09-25-2012 at 04:28 AM. Reason: Is now solved

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

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hard to tell from your post but is the product code in column A all by itself? If so, then, let's say you project code is in G1, the VLOOKUP would look like this

    =VLOOKUP(G1, $A$2:$B$9,2,FALSE)
    2 means return the second column and FALSE means you are looking for exact matches only.
    Does that help?
    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

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hello Andy,

    Can you tell me if Column A has, having in mind the first example, the data information displayed like ASDF only or ASDF - Class 4 ?


    EDIT: I'm always late


    Kind Regards,
    FCarv

  4. #4
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Something like this!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-22-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hi - that's great thanks for your help so far!

    Column A will have the product name "ASDF - Class 4 widget"
    Column B will have the sales "10"

    So - if I type in ASDF in the search cell the vlookup won't come back with anything... because multiple cells contain "ASDF". Ideally what I'd like is for the total sales for all products containing ASDF in the name to be added up if I search for "ASDF".

    Sorry for the rubbish explaination, and thanks for the responses so far - they have helped - but now I'm thinking this problem can be solved in an even better way.

    Thanks,

    Andy

  6. #6
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Upload file to solve

    Thanks
    Thameem

  7. #7
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Andy, if you use ChemistB formula with a small modification on it you should get the result you want:

    Please Login or Register  to view this content.

    EDIT: Sorry - Guess it won't work. I just tried.
    Last edited by FCarv; 09-11-2012 at 11:03 AM.

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

    Re: VLOOKUP - to return a value based on what I input to a cell?

    FCarv's formula will work if your products are in alphabetical order like your example. If they are not, it won't work.

    Another option
    =VLOOKUP(G1&" *",$A$2:$B$9,2,FALSE)
    make sure you enclude the blank space inside the quotes.

  9. #9
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Nice, I will keep that for myself as well

  10. #10
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hi Andy

    You can total sales for all products containing "ASDF" using the SUMIF or SUMIFS Function

    If your Products are in Column A = A2:A9 and your Sales are in Column B = B2:B9 Criteria in G1 = ASDF

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

  11. #11
    Registered User
    Join Date
    08-22-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hi All - thanks so much for all of the information in this thread. In fact I used a different method to resolve... as I couldnt access the internet for a while (in this day and age!) to check this thread.

    Thanks again for your help!

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

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Curious as to what method you used? Always willing to learn here.

  13. #13
    Registered User
    Join Date
    08-22-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Quote Originally Posted by ChemistB View Post
    Curious as to what method you used? Always willing to learn here.
    Oh it was nothing - just a bunch of formulas but took about half an hour as it required a formula for each product. Since I don't want to do that each time I will use the above answers in the future when I again do this piece of work.

  14. #14
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VLOOKUP - to return a value based on what I input to a cell?

    @ AndyHawke

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  15. #15
    Registered User
    Join Date
    08-22-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: VLOOKUP - to return a value based on what I input to a cell?

    Hi Cutter,

    Sorry - completely forgot about both of those. Thanks for marking the thread solved and I've now given reputation points also.

    Best regards,

    Andy

+ 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