+ Reply to Thread
Results 1 to 7 of 7

Using InputBox to Create Date Range for COUNTIFS formula

  1. #1
    Registered User
    Join Date
    09-20-2022
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    3

    Question Using InputBox to Create Date Range for COUNTIFS formula

    I'm using Excel 2016.
    I am trying to figure out a way to create a formula that takes it's parameters from InputBox entries and then executes. Here's the function I'm trying to fix:


    Please Login or Register  to view this content.
    This formula works fine if you hardcode the dates. Example:
    Please Login or Register  to view this content.
    This formula is being executed from the "EmpRpt" sheet. I need this formula to count the number of entries on the "Employment" sheet with dates that range from "startDate" to "endDate" where the column labeled "Industry" is the value entered for "industry". I've tried getting the ">=" and "<=" operators into the formula, but nothing seems to be working.

    Am I going about this the wrong way?
    Last edited by nastarius; 09-20-2022 at 10:54 AM. Reason: Add Tags

  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,422

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new here, I have done it for you today.)
    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
    Registered User
    Join Date
    09-20-2022
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    3

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    Thank you so much. Sorry about that. I will remember that in the future.

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    365 32bit Win
    Posts
    1,905

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    You could add it straight to G30 referring to the cells populated via the inputbox, but I'm not sure why you'd need add this every time.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    Quote Originally Posted by nastarius View Post
    ... to create a formula that takes it's parameters from InputBox entries ...
    You do not have the control of the correctness of the entered data, so maybe this way ?
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-20-2022
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    3

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    Quote Originally Posted by ByteMarks View Post
    You could add it straight to G30 referring to the cells populated via the inputbox, but I'm not sure why you'd need add this every time.

    Please Login or Register  to view this content.
    Thanks, this worked for me!

  7. #7
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    365 32bit Win
    Posts
    1,905

    Re: Using InputBox to Create Date Range for COUNTIFS formula

    You're welcome. Happy to help.

+ 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. create array using inputbox range(s) plus row count from elsewhere
    By Coley356 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2022, 02:10 PM
  2. Help with date range within COUNTIFS formula
    By pptdgc1999 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-28-2021, 01:07 AM
  3. Countifs with date range formula Broke
    By rogrand in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2020, 02:56 PM
  4. Countifs match criteria and date is equals to or within date range
    By tiggi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-28-2016, 11:00 AM
  5. [SOLVED] Help with InputBox for Date Range
    By george.arnold in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2015, 12:19 PM
  6. Replies: 2
    Last Post: 05-28-2014, 06:52 AM
  7. Using Date Range in Countifs formula
    By Kenny_D in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2010, 10:57 AM

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