+ Reply to Thread
Results 1 to 9 of 9

Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    38

    Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    Invoice Template1.jpg
    InvoiceTemplate1
    Invoice Template2.jpg
    InvoiceTemplate2
    CustomerList.jpg
    CustomerList

    Hey,

    I'm having a hard time finding a solution to my issue that I'm hoping one of you might be able to help me with. I'll try to explain the best I can.

    Basically, I have a drop down list of all the customers I have on file for my invoicing system (InvoiceTemplate1 picture), and then a similar list of these customers on a second worksheet, but this list contains a matching "Customer Code" that can range from R, L, C, B, Cab, etc. (CustomerList picture). What I want to see happen is, once a customer is selected from the drop down list, the "Code:" cell on the "Invoice Template" worksheet (G4) should automatically display the corresponding customer code found on the other worksheet. This will eliminate the need for any new employees from having to memorise every customer's code. I was thinking that employing some sort of Offset function would take care of this, but I'm drawing a blank.

    In an attempt to figure this out myself, I used an Index/Match formula in the cell I40 of the "Invoice Template" worksheet (InvoiceTemplate2 picture). This formula returns the cell location of the matching customer name found in the second "Customer List" worksheet. I was thinking that with this information, one could add an offset to this value, one column to the right, to get the value of the customer code to display. Not sure how to implement this, and the formula in there right now does not include the entire array of customer names found on the second worksheet. You'll see it only searches in Column A2:A34, but with the customer list formatted the way it is (landscape style), the formula gets to be too long, or with "too many arguments" when I just try to Ctrl+Select each column of customer names, so I don't think this formula would help any, but it's there in case it could be used somehow.

    Anyway, that's what I would like to see happen. I have blanked out some of the customer names, but you'll get the idea of what I'm trying to accomplish. Let me know if you have any questions. I don't mind using a macro, so long as each time a customer is selected from the drop down, that code cell will update to the knew customer code every time. Thanks in advance for your input,

    Matt

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    I'm sure you'll agree that this is hard (impossible??) to follow.

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    Hi there !

    In Invoice Template G4 try a formula something like
    =CONCAT(IF('PST Numbers and Cust List'!A2:BG34='Invoice Template'!D10,OFFSET('PST Numbers and Cust List'!A2:BG34,0,1),""))
    and enter it with CTRL+SHIFT+ENTER (not just enter - it is an array formula)
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  4. #4
    Registered User
    Join Date
    07-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    38

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    Hey,

    I have uploaded a bare bones version of my invoice system. You'll see the drop down list for the customer selection in cell B6 in
    Invoice Template worksheet. What I want to happen is, when a customer selection is made from the drop down, the customers code is
    displayed in cell G4. It should try and find this code on the second worksheet "PST Numbers and Cust List". You will see the same
    list of customers there, and in the column beside it, their corresponding customer code. So when the drop down selection is made,
    it has to find the matching name in the second sheet, then offset one column to the right to determine the proper customer code to
    display in cell G4 on the first sheet. Don't really know how else to describe it than that.

    @bulina2k Thank you very much for your suggestion. Unfortunately it did not work. It was giving me a #NAME error. I corrected some
    of the cell values to match my worksheet and varied it a few different ways, but it wasn't recognizing what I wanted to do, but I felt
    like you were on the right track with it. Maybe take a look at my attached workbook and see if that helps? Thanks a lot.

    Thanks all for your input. I await your suggestions.

    Matt
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,409

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    I think this is what you are after in G4:

    =VLOOKUP(B6,'PST Numbers and Cust List'!$A$2:$B$7,2,0)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    07-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    38

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    That one worked perfect! So simple! Thank you very much for all of your help everyone!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,409

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    You're welcome!

  8. #8
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    Quote Originally Posted by AliGW View Post
    I think this is what you are after in G4:

    =VLOOKUP(B6,'PST Numbers and Cust List'!$A$2:$B$7,2,0)

    Quote Originally Posted by windowshopr View Post
    That one worked perfect! So simple! Thank you very much for all of your help everyone!
    I'm sorry, I must of misunderstood the question, I thot that the clients are spread in multiple columns (Col A with the code in col B then in Col F with the code in col G). If this is the case please see attach.

    If this isn't the case please don't mind my answer because AliGW solution is perfect for clients on one column.


    And because CONCAT() function is available only in Office365 there is a solution using INDEX function:
    INDEX is working with array also and can pick from that array data from specified row and column

    The formula I propose is using SMALL() function to find your data row and column so it will be something like
    =INDEX([array], SMALL([array]), SMALL([array]). Anyway, here it is:


    =INDEX('PST Numbers and Cust List'!A1:BH100,SMALL(IF('PST Numbers and Cust List'!A1:BH100='Invoice Template'!B6,ROW('PST Numbers and Cust List'!A1:BH100),""),1),SMALL(IF('PST Numbers and Cust List'!A1:BH100='Invoice Template'!B6,COLUMN('PST Numbers and Cust List'!A1:BH100)),1)+1)


    don't forget to enter it with CTRL+SHIFT+ENTER (not just enter - it is an array formula)
    Attached Files Attached Files
    Last edited by bulina2k; 04-06-2017 at 05:00 AM. Reason: INDEX formula

  9. #9
    Registered User
    Join Date
    07-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    38

    Re: Enter a Corresponding "Customer Code" Value to Cell Found on Separate Worksheet

    Hey guys,

    THANK YOU Bulina2k for your help I haven't tested it yet but maybe it'll help with my next issue!! I'm hoping you guys can still help me! (not sure if this belongs in a new thread or not, but it is pertaining to the same worksheet so here goes.

    I will describe my issue.

    Using VBA, upon opening the workbook, I have a VBA code that ".clearcontents" of the cells of G4 and F7, and then after it's cleared, I use:

    Sheets("Invoice Template").Range("G4").Formula = "=VLOOKUP(B6,'Customer List'!A:B,2,0)
    Sheets("Invoice Template").Range("F7").Formula = "=VLOOKUP(B6,'Customer List'!A:C,3,0)

    ...to put AliGW's code back in, which works awesome. The problem I'm having is, after it does this, I lose all of my data validated drop-down lists in the entire worksheet! So I no longer am able to drop down my customer list in cell B6 and select a customer. It's the strangest thing. I did however once receive an error upon opening the workbook that said something like "automatic update of links has been disabled - Enable Content". I don't know what that means, but I have a feeling it's referring somehow to the link to the 'Customer List' worksheet but I'm not sure. As soon as I delete the above two formulas from my VBA code, my drop down lists return. It's so weird.

    I have attached an updated and working version of my workbook for your review. The drop down lists work fine now as I have the above code lines 'commented out. In my VBA code, you can the lines in the picture attached (I hope I made it easy to spot :P) Let me know what you guys think. It's got me perplexed but I have narrowed it down to those two lines of code being the issue here. Thanks a million! I will check back after the weekend!

    Matt
    Attached Images Attached Images
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] IF CELL is "Yes" the enter "Enabled" IF CELL is "No" enter "Disabled"
    By king10001 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2016, 09:33 AM
  2. [SOLVED] Code Clean-Up: Delete "False" worksheet created when "Cancel" is chosen in Input Box
    By Kenny Blackwell in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 08-31-2015, 10:00 AM
  3. [SOLVED] Need VBA code to replicate "Enter" key from active cell
    By PeteABC123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2014, 02:48 PM
  4. How to enter Value "skip" in same row at column AA when TargetCell was found
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-04-2013, 12:22 PM
  5. VBA code to ensure duplicate names map to same "customer number"
    By laurenh7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2012, 03:06 AM
  6. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  7. Replies: 4
    Last Post: 05-02-2012, 08:47 AM

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