+ Reply to Thread
Results 1 to 3 of 3

VBA help - date then location on custom entry

  1. #1
    Registered User
    Join Date
    01-03-2019
    Location
    na
    MS-Off Ver
    2016
    Posts
    4

    VBA help - date then location on custom entry

    I looking to write a vba to enable to following if this is possible?

    On each date "07/01/2018" in location A, B or C no more than 4 entries "Bulk" can be entered on the same day - Flag a colour

    And on the same day "07/01/2018" in locations A, B C no more than 6 entries "Pallets" can be entered on the same day - Flag a colour

    Location A can hold on any one day 4 x Bulk & 6 x Pallets
    Location B can hold on any one day 4 x Bulk & 12 pallets
    Location C can hold on any one days 4 x Bulk & 6 pallets

    In the current sheet there are 29 columns holding data
    Attached Files Attached Files
    Last edited by shawrc02; 01-07-2019 at 10:09 AM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,560

    Re: VBA help - date then location on custom entry

    Here is a non-vba implementation. It uses a helper column since I couldn't get the formula to work inside data validation. I also set up a small Excel Table to contain the maximum number of bulk and pallet you can have in each position.

    The formula in the helper column is
    =AND(COUNTIFS([Date],B2,[Location],D2,[Types],E2)<=VLOOKUP(D2,Table_Loc,2,FALSE),COUNTIFS([Date],B2,[Location],D2,[Types],E2)<=VLOOKUP(D2,Table_Loc,3,FALSE))

    COUNTIFS([Date],B2,[Location],D2,[Types],E2)<=VLOOKUP(D2,Table_Loc,2,FALSE),COUNTIFS([Date],B2,[Location],D2,[Types],E2)<=VLOOKUP(D2,Table_Loc,3,FALSE)) gets the count of Bulks for the date for the location.
    VLOOKUP(D2,Table_Loc,2,FALSE) gets the maximum number of bulk for that location.

    COUNTIFS([Date],B2,[Location],D2,[Types],E2)<=VLOOKUP(D2,Table_Loc,2,FALSE) is true if the count is less than or equal to the maximum number of bulk.

    The other half of the formula is the same logic only for pallets. Both conditions have to be True not to trigger the conditional formatting which is simply: =$F2=FALSE.

    This will not prevent bad entries, but it will flag them as they happen. It will also flag those other entries that are causing the condition.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-03-2019
    Location
    na
    MS-Off Ver
    2016
    Posts
    4

    Re: VBA help - date then location on custom entry

    Thanks for the quick response dflak i'll give this ago tomorrow GMT time

+ 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. Replies: 7
    Last Post: 04-03-2017, 06:44 PM
  2. Default location of Custom Functions
    By bmar999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2015, 12:02 PM
  3. Custom macro for removing cells containing specific location keywords
    By swoop.swoop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2014, 06:34 PM
  4. Save a Macro Enabled Template to a custom location with a custom file name.
    By andcha in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-24-2013, 11:46 AM
  5. [SOLVED] Custom Map/Chart of location
    By aehartle in forum Excel General
    Replies: 6
    Last Post: 06-18-2012, 02:16 PM
  6. Is there a way to include a cell location in the custom footer
    By NewToExcel-2007 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 09-05-2010, 06:23 PM
  7. Location of custom buttons in Excel 2007
    By mliungman in forum Excel General
    Replies: 0
    Last Post: 08-16-2007, 05:15 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