+ Reply to Thread
Results 1 to 4 of 4

Reducing a cell value using vlookup

  1. #1
    Registered User
    Join Date
    11-12-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    2

    Reducing a cell value using vlookup

    Hello,

    I have come to a sticking point and hoping someone can help.

    I have two arrays of numbers. The first is the product barcode and current stock, lets call this the "stock array". The second is the same product barcode and the number ordered by customers, the "order array".
    What I want to do is use a conditional VLOOKUP so that if the barcode appears in the "order array" I want the stock value in the "stock array" to decrease by the corresponding value in the "order array".

    I have done a VLOOKUP on the barcode in the "order array" to return the number in stock in the "stock array" and created a new cell with the revised in stock value ("stock array" stock number - "order array" qty ordered)

    Now I need some kind of VLOOKUP to use only the barcodes in the "order array" to return the new stock value and, very importantly, not to change any of the "stock array" stock values that aren't on the order array.

    Sorry this is hard to explain by text but any help would be appreciated!

    Thanks
    Attached Files Attached Files
    Last edited by CorinneTW; 11-14-2020 at 11:02 AM. Reason: Add Sample Workbook

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Reducing a cell value using vlookup

    1. Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    2. VLookup will not work for you.
    You need to be using sumif

    Something like:
    =SL1 - Sumif(ListOfPartsOrdered, PartOrdered, QtyOrdered)

    SL1 = Stock Level for Part No 1.
    ListOfPartsOrdered
    PartOrdered = Part No 1
    QtyOrdered = Qty of Part No 1 ordered on that line


    Easier to explain in an actual workbook.
    Last edited by mehmetcik; 11-12-2020 at 01:19 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    11-12-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    2

    Re: Reducing a cell value using vlookup

    Hello,

    Thanks so much for getting back to me.

    I have added a sample workbook to the original post. I think I get your SUMIF but if you could show me in the workbook that would be excellent.

    Thanks again

    Thanks!

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,558

    Re: Reducing a cell value using vlookup

    Attached is a copy of the workbook with the following formula applied:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that conditional formatting is applied to column C on the (After) Stock sheet to hide zero values.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] VBA - Creating a macro for reducing text in cell
    By moreno5 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-21-2019, 11:19 AM
  2. Reducing of materials
    By Coach86 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2016, 12:56 AM
  3. [SOLVED] reducing number in cell
    By jessyme in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-25-2013, 05:03 PM
  4. Reducing Cell Value to left 4 Digits
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 12:56 PM
  5. Reducing total number of characters in a cell in half
    By mitalis in forum Excel General
    Replies: 5
    Last Post: 01-11-2013, 09:26 AM
  6. Reducing a file size by changing cell formatting
    By LAF in forum Excel General
    Replies: 2
    Last Post: 09-23-2009, 05:20 PM
  7. Reducing the number of digits in a cell
    By Borge14 in forum Excel General
    Replies: 6
    Last Post: 08-10-2006, 11:35 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