+ Reply to Thread
Results 1 to 19 of 19

lookup value in sheet, and remove row if matching

  1. #1
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    lookup value in sheet, and remove row if matching

    Hi everyone! I am new, and happy to have joined this excellent forum.

    I have been trying to figure this out but falling short of a working solution.

    I have 3 very basic worksheets Sheet1(GoodsIn), Sheet2(GoodsOut) and Sheet3(Current).

    The goods are represented by an ID number, the problem is the ID number duplicates as it can go out of stock and come back into stock causing my VLOOKUP/filter solution to falter. I am using the following formula '=IF(ISERROR(VLOOKUP(B2,Out!B:B,1,FALSE)),"In","Out")' to compare values from sheet 2 and display an 'IN' or 'OUT' message in the column next to the 'ID Number' column.

    As an example: if ID Number 11999 comes in, it updates to Sheet3 via '=In!B1'. When ID Number 11999 is entered into Sheet2, the VLOOKUP correctly displays 'OUT'. When ID Number 11999 returns, unfortunately the VLOOKUP stops are the first value, never changing its status from 'OUT'.

    All three sheets will be increasing, so I ruled out using a range. There are also date fields in both in and out, but couldnt figure out how to Lookup the ID Number then compare dates with the most recent date removing the ID Number from sheet3.

    I've been hunting around but was unable to find a solution to ignore the first duplicate and go to the last duplicate found using VLOOKUP.

    Any suggestions for a better method for my project would be greatly appreciated.

    Thank you for you responses, in advance.

    Nach

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: lookup value in sheet, and remove row if matching

    Would it be possible for you to attach a sample file with some dummy data and examples of you problem and your desired solution?
    Thanks
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Hello Pierre,

    Thank you for your reply, sorry I did mean to upload a sample earlier. Hope this helps identify my problem.

    samplestocksheet.xlsx

    Nach

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: lookup value in sheet, and remove row if matching

    If possible I would go for a different entry sheet which would also be used as an inventory data sheet.
    And with the help of pivot table, you can easyly have an up to date inventory. See attached file
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Hi Pierre,

    Thanks again for your reply. What I am trying to achieve is a bit different to a standard inventory in the respect that the ID Number represents a unique unit that there is only one of. I guess we could look at it similar to car rental, in the fact that every car has its own number plate and it would leave the ware house to be rented, but then return after its rental.

    Does this make more sense?

    Thanks,
    Nach

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: lookup value in sheet, and remove row if matching

    Here's another suggestion.

    If you put all the data onto 1 sheet, in columns A and B, instead of IN and OUT sheets like you have, then in column C, copied down, you could use this to determine IN or OUT...

    =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In","Out")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: lookup value in sheet, and remove row if matching

    FDibbins, very clever.
    It would probably be a good thing to create a table of available units besides columns A,B and C to show directly the state of each units (In or OUT). Instead of looking into the long data of column B, in would be readily available in that table. Your formula will then be changed to this
    =IF(MOD(COUNTIF($B:$B,F2),2)=1,"In","Out")
    to take in account all data.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: lookup value in sheet, and remove row if matching

    Thanks P24, I have seen some very clever suggestions from you too

  9. #9
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Very, very clever - thank you very much

    Quote Originally Posted by FDibbins View Post
    Here's another suggestion.

    If you put all the data onto 1 sheet, in columns A and B, instead of IN and OUT sheets like you have, then in column C, copied down, you could use this to determine IN or OUT...

    =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In","Out")

  10. #10
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Thank you for that Pierre. That's a very good suggestion to help me then filter out what is physically in stock.

    Quote Originally Posted by p24leclerc View Post
    FDibbins, very clever.
    It would probably be a good thing to create a table of available units besides columns A,B and C to show directly the state of each units (In or OUT). Instead of looking into the long data of column B, in would be readily available in that table. Your formula will then be changed to this
    =IF(MOD(COUNTIF($B:$B,F2),2)=1,"In","Out")
    to take in account all data.

  11. #11
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2010
    Posts
    290

    Re: lookup value in sheet, and remove row if matching

    Hi,Nacho

    pls check attacment if helpful pls revert.
    Attached Files Attached Files
    Happy to Help

    VISHA

    Click *, if the suggestion helps you!
    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>> "Mark your thread as Solved"

  12. #12
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    FDibbins - The ID Number can be repeated throughout the list as it comes in and out, when I apply a filter to show only 'in' units it doesnt take into account if the unit has later gone 'Out', if you get me? So even though the status may have changed to 'Out' when I filter to see the 'In's it will show the previous 'In' entry.

    Quote Originally Posted by FDibbins View Post
    Here's another suggestion.

    If you put all the data onto 1 sheet, in columns A and B, instead of IN and OUT sheets like you have, then in column C, copied down, you could use this to determine IN or OUT...

    =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In","Out")

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: lookup value in sheet, and remove row if matching

    wouyld something like this help? it adds the progressive amount of "ins" on that item number...
    =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In "&COUNTIF($B$2:B2,B2),"Out")

  14. #14
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Hi FDibbins,

    Thanks again for replying.

    I find that formula counts the ID number as an 'In' even if it was going out.

    Your original suggestion of =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In","Out") is very clever and is what I am looking for. Leading on from that, i need to be able to see what is physically in stock, so I need a way to filter the 'ins' and 'outs' to automatically show what is physically in stock.

    so as an example, 11999 comes in on the 5th, but then goes back out on the 6th. I want to see what is currently 'In' the warehouse, so I filter the 'status' column to show only 'In's, this would show 11999 as being 'In' even though it went out on the 6th :

    Date.....|..ID Number..|..Status..
    5/02/13.|....11999.....|..In..
    6/02/13.|....11999.....|..Out..

    Hope you can help?

    Quote Originally Posted by FDibbins View Post
    wouyld something like this help? it adds the progressive amount of "ins" on that item number...
    =IF(MOD(COUNTIF($B$2:B2,B2),2)=1,"In "&COUNTIF($B$2:B2,B2),"Out")

  15. #15
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Hi Visha,

    Thanks for you reply. This is another solution to what I am looking to achieve, but i need a quick way to then filter or report the status of a unit to show if it is currently 'in'.

    Quote Originally Posted by visha_1984 View Post
    Hi,Nacho

    pls check attacment if helpful pls revert.

  16. #16
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: lookup value in sheet, and remove row if matching

    Here is what I would suggest you (See attached file)
    With the IN tab, you record units movements by date. The use of FDibbins formula will give you an indication of the actual condition of this unit (if the operation is either to put in IN out OUT).
    In the Current tab, you'll have the list of all your units in column A (unique number only).
    Then, the formula in column B will tell you if that unit is actually IN out OUT. You can filter this list and it won't affect the result.
    Hope this help
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: lookup value in sheet, and remove row if matching

    Hi Pierre,

    That is extremely clever and exactly what I was looking to achieve. If it doesn't take too long - do you mind talking me through the way your formula works?

    Quote Originally Posted by p24leclerc View Post
    Here is what I would suggest you (See attached file)
    With the IN tab, you record units movements by date. The use of FDibbins formula will give you an indication of the actual condition of this unit (if the operation is either to put in IN out OUT).
    In the Current tab, you'll have the list of all your units in column A (unique number only).
    Then, the formula in column B will tell you if that unit is actually IN out OUT. You can filter this list and it won't affect the result.
    Hope this help

  18. #18
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: lookup value in sheet, and remove row if matching

    Basically, it is the same formula suggested by FDibbins. I only replaced the range "$B$2:b2" by a range named "ID_No" which is a dynamic range (also see its formula). This means it grows with your data in the sheet "IN". This new formula always take into account all of transactions made in the "IN" sheet.
    Regards

  19. #19
    Registered User
    Join Date
    02-02-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    10

    Question Re: lookup value in sheet, and remove row if matching

    Hi Guys,

    Thanks for the help with this, my stocksheet has been working great since you made your suggestions. I very much appreciate it.

    I have encountered a snag - I have decided to display the information in a pivot table from the main In/Out sheet (see attached.

    What I am having a trouble with is getting excel to perform a accurate count on what models are actually in stock. If you see the attached, you will see that excel counts the amount of times the model has moved in as opposed to how many models are actually in stock.

    I'm guessing I am unable to do this using the pivot table features. Can anyone suggest a solution to count the models that are in, and disregard duplicates to show just 1 item?

    Hope this makes sense.

    Nach
    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)

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