Excel Datefinder Tool VBA

Copper Contributor

Hi guys,

I need help in developping a little tool or maybe even only a complex fomrula.

Please see the attached screenshot of my mock-up tool.  


On the left side, there is an input form containing the following parameters:

  1. The project duration in days, which is entered in cell D2.
  2. Selection of employees in column A by marking them with a "x" for example.
  3. Selection of machines in column C where the project can be implemented.

On the right side, there is a table with multiple columns. Each employee and machine has its own respective column. Column F contains the date column.


What I want to do with the tool/formula is the following:

  1. Find the earliest possible date when one of the selected employees and a machine are available for scheduling a project.

  2. Mark the selected employee and machine, along with the earliest available date, in a specific format.

  3. Display the date in cell D1 as a result of the search.


I am happy for any help because I have no idea where to start with this :(

Thank you in advance for your support. 

Best regards,


1 Reply


To create a tool that helps you find the earliest available date for scheduling a project based on the availability of selected employees and machines, you can use Excel's built-in features along with a few formulas. Here's a step-by-step guide on how to set this up:

  1. Prepare Your Data:
  • Organize your data in a format that includes a list of employees, their availability schedules, a list of machines, and their availability schedules. Each should have a separate table or range, and the date availability should be in ascending order.
  1. Create Input Fields:
  • In your Excel worksheet, create input fields where you can enter the project duration (in days) in cell D2.
  • In column A, create a list of employees and use checkboxes to allow for employee selection. You can do this by adding checkboxes from the Form Controls in the Developer tab. Assign each checkbox to a cell next to the employee's name.
  • Similarly, in column C, create a list of machines and use checkboxes for machine selection.
  1. Find the Earliest Date:
  • In cell D1, you can use a formula to calculate the earliest available date based on the selected employees and machines. You can use a formula like this:

=MIN(IF((A2:A10="x")*(C2:C10="x")*(D2:D10>=TODAY()), D2:D10, ""))

This formula checks for the earliest date where both an employee (selected by "x" in column A) and a machine (selected by "x" in column C) are available, and the date is greater than or equal to today.

  1. Display the Result:
  • The result, which is the earliest available date, will be displayed in cell D1.
  • You can format the result to your liking using Excel's formatting options.

This setup allows you to find the earliest available date for scheduling a project based on the selected employees and machines. You can update the checkboxes for employees and machines as needed, and the result in cell D1 will automatically update to show the earliest available date.

Remember that this solution assumes you have structured your data as described, and it's using a simple formula. For more complex scheduling scenarios or advanced features, you might need to consider using VBA (Visual Basic for Applications) to create a custom tool.


Creating a custom tool with VBA (Visual Basic for Applications) can offer more flexibility and automation for your scheduling needs.

Here's a VBA-based approach to develop the tool you described:

  1. Setting Up the UserForm:
  • Create a UserForm in Excel by opening the Visual Basic for Applications editor (press ALT + F11) and go to Insert > UserForm. On the UserForm, add the necessary controls and labels to input the project duration, select employees, and select machines. You can use text boxes for input and checkboxes for selections.
  1. Code the Search Button:
  • Add a "Search" button to the UserForm, and code its Click event. When the user clicks the "Search" button, the VBA code will find the earliest available date based on the selected employees and machines.
  1. Write the VBA Code:
  • In the VBA editor, write the VBA code to find the earliest available date.

Here's a simplified example:

Vba code:


Private Sub SearchButton_Click()
    Dim projectDuration As Integer
    projectDuration = Val(ProjectDurationTextBox.Text)
    Dim earliestDate As Date
    earliestDate = DateValue("01/01/2200") ' Initialize with a very large date
    ' Loop through your data range
    For Each cell In YourDataRange
        If cell.Offset(0, 1).Value = "x" And cell.Offset(0, 2).Value = "x" Then
            ' Check if both employee and machine are available
            Dim availableDate As Date
            availableDate = cell.Value
            Dim endDate As Date
            endDate = DateAdd("d", projectDuration - 1, availableDate)
            ' Check if the project duration fits within the available time
            If endDate <= cell.Offset(0, 3).Value And availableDate < earliestDate Then
                earliestDate = availableDate
            End If
        End If
    Next cell
    ' Display the earliest available date
    EarliestDateLabel.Caption = "Earliest Available Date: " & earliestDate
End Sub


This code assumes you have a data range (YourDataRange) with columns for date, employee selection, machine selection, and end date.

  1. Display the UserForm:
  • You can show the UserForm when the user wants to find the earliest available date. You can do this through a macro or a button in your worksheet.
  1. Result:
  • When the user selects the project duration, employees, machines, and clicks the "Search" button, the UserForm will calculate and display the earliest available date based on the selected criteria.

This VBA solution provides a customizable and interactive tool for scheduling projects. You can further enhance it by adding error handling and additional features based on your specific requirements. Since no one has replied to this for over a day and more, I entered your question in various AI's. The text and the steps are the result of the compilation of different AI's.


My answers are voluntary and without guarantee!


Hope this will help you.


Was the answer useful? Mark as best response and like it!

This will help all forum participants.