+ Reply to Thread
Results 1 to 17 of 17

Use Data Validation to ensure the product code of "Sold Items" is not entered again

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Use Data Validation to ensure the product code of "Sold Items" is not entered again

    I have a excel file by which I make my invoices.

    Here are the steps which I follow:

    * In sheet "Product" I enter the product code and the item description.
    *I save the excel file and close it.
    *When customer want to buy a product, then I open sheet "Invoice", enter the product code in range "B11:B31" , then I enter the rate at which I want to sell the product in range "Q11:Q31"
    *Then I press "Update Button" - It copies data from my "invoice" sheet to " Invoice data" sheet and saves the excel file.
    *If the customer pays the amount then I click on "Paid" button and if its outstanding then I press "Due" button. These 2 button "save as" the excel file to a specified location.

    So even if the product is sold , I can still enter the same product code in sheet "invoice" and make invoices. Practically the product is sold.

    So through "Data Validation" I was looking for something in which If the product is sold then sheet "Invoice" Range "b11:b31" does not allow the user to enter the "product code" which is sold.

    Sheet "Invoice data" is the sheet where sales is recorded. In sheet "Invoice data" range "F" contains all the codes of products which are sold.


    I have attached the sample file for simplification.

    Please help me if possible.

    Thank You.
    Attached Files Attached Files
    Last edited by anilpatni1234; 12-16-2017 at 01:01 PM.

  2. #2
    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,734

    Re: Data Validation

    Please take a moment to re-read forum rule #1 and then amend your thread title to something that better explains your problem. Changing your thread title is not optional, which means you must change it. Thanks!

    • Use concise, accurate thread titles.
    • Your post title should describe your problem, not your anticipated solution.
    • Use terms appropriate to a Google search - poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice tell us nothing.
    • Responding to a request to change your thread title by doing so is mandatory.

    To change a title go to your first post, click EDIT then Go Advanced and change your title.

    No help to be offered, please, until the OP complies with this request.
    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.

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Data Validation

    Thank you.
    Its been updated

  4. #4
    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,734

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Thank you - that is fine now.

  5. #5
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    hey is there anyone who can help me ?

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

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    This proposed solution employs a new column, 'Available', on the 'Products' sheet. The 'Available' column is populated by the array entered formula*:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A named range, again called 'Available', is then added and given a 'Refers To' of:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Data validation is then applied to the range B11:B31, on the Invoice sheet, with the source being =Available
    Note: Ranges for the formulas are for demonstration purposes and may be adjusted as needed.
    *Array entered formulas are confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    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.

  7. #7
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Hey thank you for your reply.

    But it does not work for me.

    When i enter product code in "Invoice sheet" range "B11:B31" then it shows that " user has restriced from enyering any data"


    Could you please help me

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

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Could you provide details of an occasion where you get that popup.
    I only get that popup if I type in an item code that has already been used or is not on the 'Product' sheet, which is what I expect. As long as I pick items from the drop down list I don't get the popup.
    Let us know if you have any questions.

  9. #9
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Hey thanks,

    So i need to choose the product code from the dropdown.

    If i dont use the dropdown and just type the product code then i get that pop up.

    Is it possible to remove the dropdown so that i can type?

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

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    To apply data validation without the drop downs use the following formula for custom data validation applied to the range B11:B31 on the 'Invoice' sheet:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This will allow the item number to be typed into one of the cells in the range B11:B31 on the 'Invoice' Sheet, as modeled in the attached file.
    After looking at the layout a bit further it may be that you were actually wanting to type the item numbers into the 'Invoice Data' sheet.
    If the latter is the case then the following formula would need to used as custom data validation and applied to column F on the 'Invoice Data' sheet:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Hey thank you for your reply,


    so right now I am able to type the product code in range "B11:B31"
    But I am still able to type the product code even if the products are sold.

    The product code sold are in range "F" of "Invoice Data" sheet.

    Please check if you could help me.

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

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    When I checked using the file attached to post #10 I was able to type "test1" in cell B12, however as soon as I tried to complete the action by either pressing the Enter key, down arrow key or using the mouse to select a different cell the pop up warning appeared. That is the way that Data Validation is expected to work.
    If you are getting different results then it might help if you would reattach a copy of the file showing the problem.
    Let us know if you have any questions.

  13. #13
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    hey thank you.

    I have attched the file.

    so the product codes "test1" and "awe" are already sold.

    But I am able to type the code in range "B11:B31"

    Even if i move to next cell, i do not get any error pop up.


    Could you please help me.
    Attached Files Attached Files

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

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    I am not able to replicate your problem. I typed "test1" in both cells B13 and B31 and got the pop up warning both times. I also typed "awe" in both cells and got the same resulting pop up.
    Perhaps this is more of a VBA issue than a formula issue. I'll ask some of the VBA side contributors to take a look.

  15. #15
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Hey thank you.
    Maybe VBA could help me.

    Thank you so much for taking so much time out

  16. #16
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    Like JeteMc, it works find for me, so I can't replicate the issue, but I don't think the issue is VBA. I suspect that the problem is Excel 2007. I've never used Excel 2007, but the internet tells me that Excel 2007 does not respond well to referencing other worksheets in your Data Validation list formula. This problem was addressed in Excel 2010. If my guess is accurate, I would suggest returning to JeteMc's suggestion of creating a named range called "Available" and using that as the range reference in your Data Validation formula. In your data validation rule for INVOICE column B, replace the reference to PRODUCT with a reference to Available, so your rule ends up being:

    =OR(B11="",AND(COUNTIFS(Available,B11),COUNTIFS(B$11:B11,B11)=1))

    Give that a try on your Excel 2007 and see if it works as desired.



    NOTE: In the attachment, I recreated the "Available" list in column T of PRODUCT using the following array-entered formula in T4, filled down:

    =INDEX(A$3:A$484,SMALL(IF(COUNTIF(INVOICE!$B$11:$B$31,A$3:A$484)=0,ROW($3:$484)-2),ROW(1:1)))

    I used this formula instead of JeteMc's formula simply because it allowed me to check changes without needing to use your buttons to update column F of "Invoice Data" and subsequently column O on PRODUCT. The "Available" list in my attachment should include everything in PRODUCT column A that's not listed on INVOICE column B. If JeteMc's version works better for what you're doing, stick with that.
    Attached Files Attached Files
    If your problem has been solved, please use "Thread Tools" to mark the thread as "Solved".

    If you're grateful for this site's existence and would like to contribute to the community, please consider posting something hilarious in our joke thread:
    https://www.excelforum.com/the-water...ke-thread.html

  17. #17
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Use Data Validation to ensure the product code of "Sold Items" is not entered again

    so i checked.

    Excel 2007 is the problem.

    Please Login or Register  to view this content.
    I am not able to enter that code in Data validation .

+ 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. Multi-select from data validation isn't working with auto-assigning data validation
    By iPenguin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2017, 12:37 PM
  2. Replies: 3
    Last Post: 06-04-2015, 02:27 PM
  3. [SOLVED] Data Validation: How to clear/delete the content of the cell and not Data Validation List?
    By lukelucky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2015, 09:42 AM
  4. Replies: 4
    Last Post: 07-03-2014, 02:37 AM
  5. Replies: 4
    Last Post: 12-19-2013, 10:44 AM
  6. Adding Date Data Validation to cells with List Data Validation
    By biggtyme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 09:47 AM
  7. Using Defined Names with Data Validation Depend and Data Validation Multi Select
    By Vinnie Chan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-01-2012, 05:36 PM

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