+ Reply to Thread
Results 1 to 89 of 89

Search list for known values

  1. #1
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Wink Search list for known values

    Thank you in advance, Any help would be appreciated.
    I have a spreadsheet that contains several columns with headers in which I will copy/paste values in.

    I am using Excel 2010.

    I want a macro or embedded formula to locate the "ItemNumber" in [DatabaseList] that matches the "ItemNumber" in [MainSheet], based on several columns of values.

    again I greatly appreciate your help, I have been struggling with this for some time, I tried vlookup, and even exporting into access and running code based on queries, really I am not sure what to do.

    All Information needed to understand exactly what I'm asking is on the attachment.

    All items come from a access database, but the question is not about that, the question is about the "ItemNumber" that on MainSheet and the corresponding ItemNumber on the other sheet and its values in the columns I mentioned in the workbook. Please refer to the workbook, start with
    MainSheet first.
    Thank you...
    Last edited by lanziniad; 11-07-2011 at 02:15 AM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    Hi,

    Welcome to the forum. When looking at your workbook for ItemDescription. I can not see how you determine this. Nor do I see where the "Quantity" comes from.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Well I replied in the main thread, my bad. I am new at this. To answer your question all informationcomes from a access database that runs queries and then exports that information to the MainSheet and also exports the spreadsheet database list. If you open the mainsheet and read what wrote there and then goto databaselist it should clear things up for you.

  4. #4
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    its not "Item Description", there is no column named that, its "ItemNumber" as stated in the spreadsheet.

  5. #5
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    I apologize Item Description does exist, it comes from mainsheet along with the rest of the values.

  6. #6
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    Hi,

    This is what I'm referring too. I do not see anything for it. How did you determine it and the rest of the Item descriptions?

    "RH BRDR SEL 20N 5/8"

  7. #7
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Those values in the example are a portion of the spreadsheet "MainSheet" located in the other tab on bottom, those values are brought in via a database. I just copied it from there to use an example. I am sorry for the confusion, hope this clears it up for you. And I really appreciate you help.

  8. #8
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Is there any experts out there that can help me, please I really need to complete this project soon. Thank you very much.

  9. #9
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    Hi,

    In your example would "366H" meet your criteria?

  10. #10
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Yes it could be, it is the formula name for the ItemNumber, though it is not unique as the ItemNumber is, due to the fact that there are different ItemNumbers that are also called by those formula names, due to different customers ordering the same item. If I need to change the left most column to a unique identifier that should not be a problem.

  11. #11
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    Hi,

    I keep re-reading your info and sorry too say I still can not see what you mean. You mention a unique id. Could you set one so we can see what it would look for. Or, after you set it provide a example of the data.
    I'll keep looking at this, but maybe another member could also take a look and see what they can come up with.

  12. #12
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    I have revised the spreadsheet, you will find hopefully more information on what I am needing, and I tried to explain the information a little better, what this is, is a spreadsheet that is linked to an access database; from the access database I retreive work orders via my work intranet site, then I paste the workorders to the MainSheet of the spreadsheet, and then take that same information and put it through an access query or two to link needed information to the ItemNumbers, i.e. approved follow information, and then export that to the Databaselist sheet. hope this helps.

  13. #13
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    HI,

    Could you post the revised workbook?

  14. #14
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Here is the revised version of my workbook.
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need VBA help to search list for known values

    lanziniad,


    It looks as if I'm the only person trying too help you and sorry to say I still can not comprehend what you want.
    Are you starting at the top of the list and looking down? If so in the Mainsheet example you do not show it in sequence as that of the main list. Can you look at it and start with the first row going down and tell use what it is that you are comparing. B/C you are not showing 0047676 in the mainsheet example.

  16. #16
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Need VBA help to search list for known values

    Charles,

    First of all thank you for sticking with me, I have made a complete mess of things, I'm starting to confuse myself with this thing.
    Anyway if you don't mind, I am going to revamp this Workbook and then reattach it with what I believe will clear up some fog. This may take me some time, so again I appreciate your patience with me.

    Check back tomorrow night, it should be completed by then, if not I will make a reply.

    Thank you....

  17. #17
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    This is a copy of the actual workbook minus code.

    Hope this one helps you help me. I am out of ideas on how to explain what I'm needing here.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Thanks. I'll take a look tomorrow and see if I can help.

  19. #19
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Thank you Charles.

  20. #20
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    I think I'm getting closer too what you want.
    Ok, you want the code too loop down the "Finished" sheet and check the Approval" sheet.
    Now will the data in the "Finish" sheet already be there? Or will I need to populate it except for the "Formula"?

  21. #21
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Yes the finished sheet is where I will paste the lineup and then press the button to cross reference the approvedfollow, and the preventfollow sheets.

  22. #22
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Added columns to PreventFollow sheet

    Charles,

    I appologize in advance but I have forgotton two key columns in the PreventFollow sheet, I am going to re-upload the workbook with the changes.

    Just to explain it: Some Formula or ItemNumber's may contain extra information concerning the PreventSpecies, That will be found in the last two columns, PreventContaining, and the next which is just the unit of measure used, ie.. grams per ton or GRT.

    So for instance it may say that a Formula has a prevent due to whatever Additive, and if it contains extra information in the PreventContaining column then it is limited to that Additive.

    PreventContaining column is a list of Additives if that Formula is prevented from mixing before or after a Species contiaining that particular Additive, otherwise if the Formula is in the PreventFollow sheet it is prevented from mixing before or after what ever the PreventSpecies is, like stated before on the PreventFollow sheet.

    Sorry about this, it slipped my mind..
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    My VBA code for pasting and sorting the Lineup

    Charles,

    Here is my Code for my worksheet, minus all that I need you to figure out about the Approved / Prevent stuff.

    Anyway thought maybe this would help.

    What I do is Copy the Lineup, then press pastelineup on the MixerLineup sheet and it does its thing, it works, but of course it needs to do so much more.

    Forgive my sloppy VBA skills.

    Just a question, when I delete the current lineup by pressing delete, it does delete all the sheets, but I have to close the workbook and then reopen it inorder to get the paste button to work again on another lineup? Maybe you could shed some light on how to fix that.
    Attached Files Attached Files

  24. #24
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Not a problem. I started to do some code work on this. I have a question about "1XNA". In the finish sheet you have it in row 2. When I look at the "Approv" sheet and look at "Specie"
    I see it's "Cattle" and I then look at "Approved Species" I see "Cattle" and too in column J/K I see All and column "G" i see an additive. From this I conclude it would be a "Good Follow" is this correct? I know on the Finish sheet you did not show it as "Good".

  25. #25
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Yes its a good follow. If the ApprovedLifeStage or ApprovedProductType say "ALL" Then as long as the Species is Approved, it doesnt matter about the LifeStage or the ProductType.

  26. #26
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    The reason I didn't put anything next to the 2nd row, is because that is the first run as long as I dont mix anything after it that would be in the PreventFollow sheet its good to go.

  27. #27
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    What is the Additive for "14TM" you have it in the Finish sheet but not in the Prevent flow sheet.

    I need an update for the worksheets. You have "Formulas" in the "Finish" sheet, but not in the "Approved" or "Prevent"
    Please verify and make correction for any and all "Formulas" that may be missing.
    Last edited by Charles; 11-11-2011 at 02:00 PM. Reason: need update to worksheets

  28. #28
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    They don't belong in the Approved or the Prevent because they do not contain any additives. If an ItemNumber does not contain an additive it will not be in those sheets.

  29. #29
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Need some info about "14TM". In your sample you have it as a "BadFollow" that part I get, however, when you look at "3152" this is also a bad follow. In you example you said

    "BAD FOLLOW - THIS PRODUCT CAN NOT BE MIX BEFORE OR AFTER SPECIES IN THE PREVENTFOLLOW SHEET. 14TM IS A DAIRY SPECIES. THIS WOULD HAVE BEEN A GOOD FOLLOW IF THE PRODUCTS BEFORE AND AFTER WERE APPROVEDFOLLOWS."
    Being "14TM" was not listed in either sheet was the reason for the "BadFollow"?

  30. #30
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Since 14TM is a dairy, you are not aloud to run 3152 before or after dairy feed because it contains CTSM; which "Dairy" is in the preventfollow sheet.

    If a product is in the preventfollow sheet, look at the preventfollowspecies and if the species is before or after that product located in preventfollow sheet both it and the product in the preventfollowspecies column are considered bad follow. Hope this helps.

  31. #31
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    HI,

    This goes back too the question how do I know "14TM" is a "Dairy" product. Is it because I could not find it in either Approved or Prevent sheet?

    I added an attachment. Click the button to see result. I do not have it coded for the "Red" I have it code so that you see what in Bad and Good. If all of your test is ok then we can change it to color code.
    Attached Files Attached Files
    Last edited by Charles; 11-17-2011 at 02:14 PM. Reason: Added Attachment and info

  32. #32
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    You are absolutely right, there is no way to know that, I apologize, didn't even think of that, I will amend the worksheets and repost it.

    Again I apologize. Thank you for your work so far, ill download the workbook and check it out later, I'm on my cell right now.

  33. #33
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Thanks, I'll be looking for the workbook.
    Test what I sent you may not need to repost work book.

  34. #34
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    I tried the workbook code and it seem to work, but when I change the formula to a known prevent follow it fails to say bad follow...

    Here is the updated workbook, with the needed information.

    Thanks for all your hard work. It is greatly appreciated..
    Attached Files Attached Files

  35. #35
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    I was taking a look at your code, you do know that the lineup will not always be the same, some days it may have swine in it, or chicken, pheasant, or what ever. Every time the lineup changes and I paste it to the MixerLineup sheet, it will automatically be queried with the information needed for the ApprovedLineup sheet and the PreventLineup sheet, if anyone of those formulas do in fact contain an Additive.

    So with that, the Species of the Product on the lineup will not always be a "Cattle", or a "Dairy", so the if statements for "Cattle", "Dairy"; someday maybe for "Swine", ect.... depending on what formula is run that day.

    I hope I am not adding a whole lot of problems to the mix, and maybe Im reading the code wrong that is entirely possible, for I am no VBA expert like yourself.

  36. #36
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Hi, I have the code look for Cattle and then run that portion of the code where I have it set to look for cattle in column J if it's cattle then it would try to determine if it can be a good or bad follow. With the latest attachment I believe I have a better unterstanding of what you want. I'll look at it as much as I can tonight, but may not be able to work on the code until this week. I will be home on Friday long enough to do the code correction. Hopefully I can get the code to work this weekend. I'll post it here if I do.

  37. #37
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    You mentioned
    "I tried the workbook code and it seem to work, but when I change the formula to a known prevent follow it fails to say bad follow..." What did you change?

  38. #38
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Like I said in my last posting, the MixerLineup will not be the same, each day a new Lineup comes out, and each day I will paste it to the Finished sheet and run the code.

    Anyway I wrote all this in the last post. Im not sure why it didnt work. I think it has something to do with the parameters that the code is working under, for instance.

    If I run a dairy with no additives, then after try to run a dairy that contains an additive that has dairy in its preventspecies column; both of those rows should say bad follow, since dairy is prevented from following a product that contains an additive that has dairy as its preventspecies, it is also prevented from being run before that product as well.

    This doesnt just apply to dairy, what ever the product may be, if it contains an additive and has a preventspecies, that species cannot run before or after that product(Probably should have renamed PreventFollow to something like PreventBeforeAfter), anyway, as far as approvedfollow goes that only has to do with following the product that contains the additive, if a product does contain an additive, the only approvedfollow product must fall into the parameters of the approvedfollowspecies, ...followlifestage,...followproducttype...

  39. #39
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    To answer your question, "What did you change?" I changed the Formula code above the 3152, to another product formula name which should have triggered a badfollow, but it said that it was good?

    Like I said, not sure why?

  40. #40
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hi,

    Can you tell me what the formula was?
    You change 14TM to what??
    About ready to go off.

  41. #41
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    I changed it to IJ36.

  42. #42
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    I tried a dairy (1j36) before the 3152 and then after it, and it said goodfollow.

  43. #43
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    hey,

    Is the formula the unique identifier, it should be the trigger to find what the species is and to see if it is in the approvedfollow and or preventfollow if it is to be run after a product that contains a additive, and it that additive contains the productspecies name of the product that is to run around it, in the preventspecies column it should read bad follow.

  44. #44
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Thanks for the update. I'm going off line now. But, will look at it again in the am before I take off for the day. I'll get something back to you this week end. Sorry for the long delay.

  45. #45
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Hey Charles,

    example:

    1J36(DAIRY)
    3152(CATTLE, CONTAINING CTSM; DAIRY IS A PREVENTSPECIES FOLLOW) [BadFollow] - Dairy is prevented from running before or after any product that contains CTSM!

  46. #46
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hey,

    Thanks for the info. I'll be working on this when I return.

  47. #47
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    This is what I came up with.
    Attached Files Attached Files
    Last edited by Charles; 11-20-2011 at 09:06 PM.

  48. #48
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    14tm as a product does not belong in the approved or the prevent sheets, because it does not contain an additive. Only products that contain additives will be found in those sheets because the approved sheet shows what products can run after those products that contain additives, the preventfollow sheet is a list of those products that contain additives that are at a level or potency that some products are stricken from running before and after so they are considered a preventfollow.

    The information sheet shows all products on the lineup so you can see what each product is.

    If you have any questions, ill be more than happy to answer them. Thanks again.

  49. #49
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    I'v revised my post as too the 14TM. And too in the attachment in my last post should take in the fact that 14TM is not in the Approv or Prev sheets. Check it and let me know what happens.

  50. #50
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Thank you, but if I change the formula below the 3152 which contains CTSM both the 3152 and the dairy formula I placed below it should read bad follow.

    This lineup will change daily, so today it may have looked like this, tomorrow it may not, the rows must respond to what additive the product may or may not have, and whether or not that product that is placed around the one with the additive is an approved follow or not.

  51. #51
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    The Formula of these products don't matter, I can run a dairy before or after a cattle or vice-verca, what matters is if a product contains an additive and if it does, whether or not the products run before and after are not in the preventfollow and are found in the approvedfollow if they are to follow the product containing the additive.

    So I should be able to change the Formula name to a formula that is on the current lineup and knowing that it can not run before or after a formula that contains CTSM because it is a dairy, after pressing the button, both the dairy and the product containing CTSM(ctsm is just an example, could apply to any other additive,but that will be desplayed in the follow sheets) should have colored red or in this case said "Bad Follow"

  52. #52
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Exclamation Re: Search list for known values

    Charles,

    I revised the Workbook again, added another column to the lineupInformation sheet. And I put a note on the FinishedLineup sheet; its acting a little funny, try the example on the FinshedLineup sheet, see what you think.

    Thanks again..
    Attached Files Attached Files

  53. #53
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Thanks for the update I'll look it over.

  54. #54
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Hi, lets see how close this one is. I changed the 14TM and 3152 around as you suggest.
    Attached Files Attached Files

  55. #55
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Search list for known values

    cant understand , please do more

  56. #56
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    That worked good, but when I changed the formula below the one with CTSM to a dairy formula it again said goodfollow.

    Not sure how you are calculating whether or not the formulas above or below can run around a product containing an additive, let me know please, or are you just running the code on those few rows for practice?

  57. #57
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    I did make some changes of my own, but...I'll step thru it again and make more changes.
    I have the code looking at Current then it should look at the previous formula and the look at the next formula to see if in Prevent sheet. If it is it should say "Bad".

  58. #58
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Is it looping through every row? Because I try to change some of the formulas on different rows and it doesnt work right.

  59. #59
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    The code should loops thru the "FinishedLineup" sheet.

  60. #60
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hi,

    I can see where the code is not working with the change that you mentioned.
    I'll re work the code.

  61. #61
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Thanks Charles for your help.

  62. #62
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    Ok. I revised the code. And I left in the last test that I did.
    I,m leaving shortly, but will be back latter today.
    Attached Files Attached Files

  63. #63
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Ok I will check it out, thanks....

  64. #64
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    I tried the code, it looks good until I changed the first formula to 3152, then 30AC which contain an additive that dairy is in the prevent, and it said good, also the third formula did the same and the next to last also, if the product before and after is in the prevent of the formula in the middle all of them should read badfollow..

  65. #65
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Here are my findings.
    Attached Files Attached Files

  66. #66
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    HI,

    I was looking at the latest problem. When I verified the "LineUpInfo" sheet there are some items missing "13DW" for one. I have the code set too look at this sheet to get the species for the formula Current/Next and Previous. I use this too validate what is in the prevent sheet. You also mentioned "361B" has a Preventive "Dairy" when I looked at the Prevent sheet "361B" did not show Dairy as being prevented.

  67. #67
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles
    Yes you are correct, not sure why 13dw was in there, and you're also right that 361b has no prevent for dairy, sorry about that. How's the coding going other than me adding headaches with my mistakes? If you have updated the code, i would like to check it out.

    Well you have a happy thanksgiving, talk to you soon.

  68. #68
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hi,

    Can you post a workbook that has all of the correct data, and too show what you expect too see.

  69. #69
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Sure ill send it in few hours.

  70. #70
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Here you go.
    Attached Files Attached Files

  71. #71
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Thanks,
    I'll look at as soon as possible.

  72. #72
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    HI,

    Should "361B" show "Dairy" in the Prevent sheet?

  73. #73
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    No I was wrong again. I looked over the workbook and Re did the finished sheet all is good now.

  74. #74
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    did you update the previous attached workbook?

  75. #75
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Yes I attached it.

  76. #76
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    I do not see "Dairy" in the prevent sheet for "361B".
    Have to go off line.
    Will check back tomorrow.

  77. #77
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Yes I know, I was wrong about that, I revised the workbook and resent it earlier. I redid the finished sheet with the corrections.

  78. #78
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    What about the "Prevent" sheet. For "361B" I do not see "Dairy". I only see in the "PreventSpecie" column
    EXOTIC
    HORSE
    SWINE
    RABBIT
    EXOTIC

    Should I not see Dairy also?

  79. #79
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    No Dairy is not in the Prevent for 361b, i made a mistake there, sorry. 361B does not have dairy as a prevent.

    But on the other hand, dairy is not an approved follow for 361b!

  80. #80
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    lanziniad,

    For 1FU2 you said

    "BAD - DAIRY IS NOT APPROVEDFOLLOW AFTER FISH OIL (34A0 CONCTAINS FISH OIL/FISH SOLUBLE %)"

    The code is set too look for the "Species" in the Prevent sheet. It does not look for the "AdditiveName" and if it was set up too look for it I would need to know what too look for.
    And, too, how would I know that in the above statement that "Dairy" can not follow "Fish Oil"?

  81. #81
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Because, if you go to approvedfolow sheet and find 34A0 you will see that it contains several additives, one of the additives is fish oil and on fish oil dairy is not an approvedfollow, hence dairy can't follow 34A0.

  82. #82
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    But how do I know or the code knows to check the additives and determine what should be or not? I need to tell the code to check for some thing. That's why we are using the "Prevent" sheet.

  83. #83
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,
    To answer your question about knowing whether or not a product is not an ApprovedFollow, lets take the dairy and fish oil problem, since we are referencing the product 361B and it contains Fish Oil(among other additives), first we find the product name 361B in the ApprovedFollow sheet and find the Additive(s) it contains and look over to the ApprovedFollowSpecies, Lifestage, ProductType columns, if Dairy or whatever productspecies you are trying to follow the one with Additive(s) with is not in those columns then it is not approved to follow it, only productspecies that are found in those columns are aloud to follow the product containing that Addditive.

    Charles,
    I don't think you fully understand what I am wanting to accomplish here. I will do my best to explain. I start with a list of information(which is a lineup) that has to be mixed. On this lineup which I will receive a new one each day, are several different types of animal feed, but the problem is we cant just mix it in any order, due to federal regulations, it must follow a strict order so as not to contaminate the animals and the end consumer.

    So knowing that each product is different(there are sometimes several runs of the same product, for different work orders) anyway not all products will contain an additive.

    Additives are the key to whether or not another product can mix before or after the product containing the Additive: In order to know whether or not a product does contain an Additive, we use Formula Names to reference the type of product it is, so that is the importance of the Formula.

    Additives are the main focus of this spreadsheet: I want to be able to take the lineup from "MixerLineup" sheet, bring it into the "FinishedLineup" sheet and be able to cut and paste rows to see whether or not that particular product can run in that position. This is where the code comes into play.

    WHAT THE CODE SHOULD DO:
    The code is supposed to check the left column starting in the second row find the Formula name, check(lets say for sake of argument, because I'm not sure how you are referencing if it contains an additive or not)the "LineupInformation" sheet to see whether or not it contain contains any additives and if it does, then go to the "PreventLineup" sheet to see if the product that is to run before and after it is located in the "PreventFollowSpecies" column(if the species of the product to run before or after the product that contains the Additive(s) is found here then both those products and the product containing the Additive(s) are not allowed to run around one another, therefore should be highlighted red. (Bad Follow)

    If they are not in the "PreventFollow" sheet then the product before the product containing the Additive(s) is good, but we must now reference the "ApprovedFollow" sheet, to see whether or not the product (species, lifestage and producttype) are a match to the ("ApprovedFollowSpecies", "ApprovedFollowLifestage" and "ApprovedFollowProducttype") (sometimes the "ApprovedFollowLifestage" and the "ApprovedFollowProductType" says "ALL" in this case as long as the Species is found in the ApprovedFollowSpecies column) it is approved to follow the Product containing the additive(s), (but we must reference all additives the product may be containing, to see whether the follow product is approved to follow the product that contains the Additive(s)! (Some products contain several Additives, if one of the additives do not have the follow product in its (ApprovedFollow columns) then that product is not an approved follow), therefore that product after the product containing the Additive should be highlighted red, it is a bad follow.

    I hope this clears any confusion up, if not feel free to ask. Talk to you later.

  84. #84
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    I am not sure how to make all this happen, I just know what needs to happen, thats why I came to the excel experts. I wasnt even sure this could be accomplished in the first place. Hey but you are doing such a good job. I thank you...

  85. #85
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Thanks for the update. I'll read what yo sent.
    I may have too amend the code to check the "Additives column in the Approved sheet.
    The code currently does not look at the Additives. It look at the "Prevent" sheet and if the formula say 5132 is in the Prevent sheet and it has a Dairy that is in the "PreventSpecies" the code should say "Bad". But I guess I'll have to re think my logic to include the Additives.

  86. #86
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    charles,

    Hows it going?

  87. #87
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hi,

    Getting closer to the final result. Stepping thru the code. But as usual there are conflicts.
    When I show "Bad" it should be "Good".

  88. #88
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Search list for known values

    Hi,


    Lets see if this works. If not let me know what you changed to cause it too fail.
    Attached Files Attached Files

  89. #89
    Registered User
    Join Date
    11-05-2011
    Location
    Missouri
    MS-Off Ver
    Office 2010, VBA 7.0
    Posts
    75

    Re: Search list for known values

    Charles,

    Here are my findings, I placed a Note on the FinishedLineup sheet.

    thanks...
    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)

Tags for this Thread

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