+ Reply to Thread
Results 1 to 26 of 26

Limit data entry with Data valitadtion based on date

  1. #1
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Limit data entry with Data valitadtion based on date

    I thought that I had the answer to this earlier from one of the forum contributers and I closed out the question, but of course the user has changed the requirements, and I can't get the code to change to what I need now.

    I need to have datavalidation apply to a range of cells (J9:j139) where it checks to see if the previous cell in the range holds an "F" or an "H" then limit the entry accordingly based on the date field for that row:
    • The use of the "H" value can only be used once per day, and no other "H" or "F" values can be added for that date
    • The use of "F" can have multiple rows for the same date
    I also need to be able to count unique "F" days and "H" days The "H" days are easy [=COUNTIF(J11:K139,"H")] once I have the data validation properly set, but the "F" days are stumping me.
    Attached Files Attached Files
    Last edited by Phraedrique; 01-24-2012 at 06:35 PM. Reason: Spelling / typo corrections.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    It would help if you can include the link of earlier query to understand the flow.
    Also, I have checked the file you attached, and since the data is not entered hence appearing little confusing / lengthy to understand. Fill out some dummy results and highlight what you need as an answer there. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Dilipandey:

    There is data in the form already, but you may need to scroll up to the top of the sheet (there are over 150 lines in the form) to find the data that I included. The work flow is supposed to be that a driver cannot record "field" miles on the same day as the driver has "Home" miles on the form, but any day that they do record "Field" miles, if they make more than one trip, they are required to record them seperately.

    i.e. On Tuesday, the driver only reports to the home office and goes nowhere else, thus s/he records Tuesdays as an "H". On Wednesday, the driver takes five seperate trips into the field, thus recording five seperate "F" trips for the same day.
    The form needs to take a look at the travel status field, and then count the days that were marked "F" not just the occurances of "F" in that collum.

    Also, the datavalidation in collumn J needs to prevent a user from entering in more than one "H" for a single day, and also prevent the user from entering in both an "F" and an "H" for a single day, while ALLOWING the user to enter MULTIPLE "F" entries if there is no "H" for that same day.

    Thanks for looking at this!

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    You have asked multiple things in one post. Below are my remarks on each of them, separated below:-

    1) A driver cannot record "field" miles if he had entered "H" under column "TRAVEL STATUS".. right?
    2) Driver can enter "F" any day (or number of days) but then they must not enter any of these days with "H"under column "TRAVEL STATUS".. right?
    3) So a driver can enter either Fs for more more rows... but Hs can be only one row .. keeping above scenario in mid
    4) Also I need to know which column is meant for recording "field" miles?
    5) I do not see five separate Fs trip for the same day (i.e, Tuesday 1-18-2012) as I see only two rows related to this which are row 18 and 19.
    6) your last para for validation is crystal clear.. thx for that.

    Please provide your remarks to my above points. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Quote Originally Posted by dilipandey View Post
    Hi Phraedrique,

    You have asked multiple things in one post. Below are my remarks on each of them, separated below:-

    1) A driver cannot record "field" miles if he had entered "H" under column "TRAVEL STATUS".. right?
    2) Driver can enter "F" any day (or number of days) but then they must not enter any of these days with "H"under column "TRAVEL STATUS".. right?
    3) So a driver can enter either Fs for more more rows... but Hs can be only one row .. keeping above scenario in mid
    4) Also I need to know which column is meant for recording "field" miles?
    5) I do not see five separate Fs trip for the same day (i.e, Tuesday 1-18-2012) as I see only two rows related to this which are row 18 and 19.
    6) your last para for validation is crystal clear.. thx for that.

    Please provide your remarks to my above points. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    1) correct, no field miles FOR THAT DAY if the driver records "Home" miles FOR THAT DAY.
    2) correct
    3) Correct, multile entries of "F" for a single date, or a single entry of H for a single date
    4) All miles are recorded in the same collumn and a calculation is done based on the "H" or "F" status in the row in a seperate cell. this is done by subtracting the total home miles (currently incorrectly calculated by the original author of the workbook by multiplyint the Round Trip Milage in U8 by the number of days of "Home travel") from the total miles traveled (=sum(h11:h139)
    5) sorry about that... I was suggesting a POSSIBLE instance, not actual sample data in the example worksheet. i.e. a person COULD have 5 or more "F" trips on a single day and they all need to count as a single instance in the "Total Field Days Used" value (cell n142)
    6) well a stopped (analog) clock is correct alt least twice per day... (thanks...)

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    See the attached file and let me know if this suits.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Hummm... thought that this was working, but for some reason, while I am able to enter as many "F" values in the travel Status column, I am not able to enter any "H" values if there are any date entries in colum B at all.

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Yes. ... this is fine as per my point no. 2.
    e.g. 1-12-12 is already having Fs in the starting and now if you want to enter 1-12-12 at bottom and try entering H for this, it won't accept and this is fine.

    Let me know further details on this.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    errr. perhaps we are not on the same page here for point #2. The user needs to be able to enter an "H" on any given day as long as there is no other entry for the same day (neither "H" nor "F"), AND must be allowed to enter multiple "F" entries in that same "Travel Status" column.
    i.e.:
    Column B Column J
    1-1-12 H
    1-2-12 F
    1-2-12 F
    1-2-12 F
    1-2-12 F
    1-3-12 F
    1-4-12 H
    1-5-12 H
    1-6-12 F
    1-6-12 F
    Would be a valid set of data in the worksheet. So what I need to be able to do is limit data entry so that each "H" value has a unique date with no other values allowed for that date, and that multiple rows of "F" values are allowed on single dates, but no "H" is allowed to be on the same date as an "F" value.

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    Revised the attachment after your clarification. Let me know if this suits

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Unfortunately, while the "H" value can be entered for disticnt dates, the formula is now allowing "F" value to be entered into the field on the same date as an "H" value.
    Is this somethignthat Excel just cannot do?

  12. #12
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    It's not like that.. just tested.
    F value can be entered if the same date has H or F or both...I mean with single H, multiple Fs can be entered...

    On my above attachment, Date 1-16-12 in row 16 has H and then at bottom I can enter 1-16-12 with f.. just tried it 2-3 times down the row and it is working file... see the attachment.


    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    errr... no, dates CANNOT have BOTH an H and an F in them. Dates can only have a SINGLE "H", OR multiple "F"'s.

  14. #14
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Dear Phraedrique..

    You are contradicting your statement.. you said "dates CANNOT have BOTH an H and an F in them" and just after it you are saying "Dates can only have a SINGLE "H", OR multiple "F"'s...

    I understand that a date can have only one H and multiple Fs.. and this is what I am able to enter into the spreadsheet.

    Would suggest you to test the spreadsheet basis above logic and highlight the cells with comments (right click - insert comment). Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  15. #15
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Quote Originally Posted by dilipandey View Post
    Dear Phraedrique..

    You are contradicting your statement.. you said "dates CANNOT have BOTH an H and an F in them" and just after it you are saying "Dates can only have a SINGLE "H", OR multiple "F"'s...

    I understand that a date can have only one H and multiple Fs.. and this is what I am able to enter into the spreadsheet.

    Would suggest you to test the spreadsheet basis above logic and highlight the cells with comments (right click - insert comment). Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    First, I want to thank you for your efforts here... I am realy trying NOT to complicate things, but you seem to have misunderstood a basic need here. The underlined and highlighted statement above is false.

    If you look at the table in post #9 you will see that none of the dates contain BOTH an H AND an F.

    Additionally, While it is possible for a single date to contain multiple F's, no date can contain more than one "H".
    2-Jan h Unique date, unique H
    3-Jan f Unique date, unique F
    4-Jan h Unique date, unique H
    5-Jan f unique date, multiple f
    5-Jan f unique date, multiple f
    5-Jan f unique date, multiple f
    8-Jan h Unique date, unique H
    9-Jan h Unique date, unique H
    10-Jan f unique date, multiple f
    10-Jan f unique date, multiple f
    10-Jan f unique date, multiple f
    11-Jan h Unique date, unique H

  16. #16
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    May be you are not using the revised n updated attachment.
    Use the one from post 12.

    Also would suggest you to enter one batch of data containing all possible scenarios and highlight / comment the culprit cells

    I am logging off now n will look into this later.
    This is really getting interested to me . Cheers .

    Regards,
    DILIPandey

    <click on below star if this helps>

  17. #17
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    M805-sandbox (2).xlsmYes, I just tried the one from post #12 again, and I am still able to enter H values in dates that already have F values in them. I have made some comments to the file and will attach it below.

  18. #18
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,696

    Re: Limit data entry with Data valitadtion based on date

    Pl see the attached file.It may meet your requirements.
    I have done validation in M805 (2) Sheet.
    When same date is not available in previous entries it takes from cell O2.If your value is not there in O2 change it.
    ie,
    Say tou are making entry in J20.Date in B20 is not available in B11:B19.Now you can enter value avilable in O2.
    If O2 contains f you enter only f. If you want enter h in J29, first change value of O2 to h and enter value h in J20.
    Appers cumbursome.Sorry for that.

    Clarifications are welcome.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 01-21-2012 at 06:23 AM.

  19. #19
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    Considering all the scenarios, I have developed the attached spreadsheet and would suggest you to go through it and test it to satisfaction.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  20. #20
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,696

    Re: Limit data entry with Data valitadtion based on date

    PL see attached file.I have added code for sheet change for M805 (3).Used AC1:AC3 for validation.
    clarifications welcome.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Quote Originally Posted by kvsrinivasamurthy View Post
    PL see attached file.I have added code for sheet change for M805 (3).Used AC1:AC3 for validation.
    clarifications welcome.
    Interesting attempt, I liked the formulas in AC1:AC3 but unfortunately I am still able to enter H and F values on the same date.
    So, again, I need to be able to limit all dates to a single value (i.e. all entries for 1/12 can be EITHER an "H" or an "F") and for any date that has an "H" that then prevents any further entries of any kind for that date, while allowing any date that has an "F" value in it to have multiple "F" entries.

  22. #22
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,696

    Re: Limit data entry with Data valitadtion based on date

    Pl see the attached file.
    Attached Files Attached Files

  23. #23
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,696

    Re: Limit data entry with Data valitadtion based on date

    Pl see attached file in previous post.
    Last edited by kvsrinivasamurthy; 01-24-2012 at 06:07 AM.

  24. #24
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    Hi Phraedrique,

    Hope you have checked my last post with attachment.
    Looking forward for your verification results.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  25. #25
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Limit data entry with Data valitadtion based on date

    Quote Originally Posted by dilipandey View Post
    Hi Phraedrique,

    Considering all the scenarios, I have developed the attached spreadsheet and would suggest you to go through it and test it to satisfaction.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    This is PERFECT! I was even able to copy and paste it directly into the worsheet as is and it tested properly without a hitch...

    Now, what the heck IS it???
    Last edited by Phraedrique; 01-24-2012 at 03:27 PM.

  26. #26
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Limit data entry with Data valitadtion based on date

    You are welcome Phraedrique...

    cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ 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