+ Reply to Thread
Results 1 to 2 of 2

VBA Code to return data if within X amount of hours

  1. #1
    Registered User
    Join Date
    01-09-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    77

    VBA Code to return data if within X amount of hours

    Hey all,

    Hoping to find some help regarding the following issue (workbook attached).

    Basically I have a table full of data (tab = 'Analysis'), in there is 'Date' (Column C) and 'Sugar Consumption' (Column W). On 'Sheet2', I want to be able to enter in an hour amount (in this case, 6 hours), and if the date & time in any of column C is within 6 hours, then display how much sugar will be used (either in a list as I have in the attachment, or in 'total consumption' - doesn't matter).

    I have the table sorted by start time so it's easier to view.

    So basically the end user would be able to type in any amount of hours, click the button, and all of the lines within that amount of time would display the sugar consumption.

    Any ideas? Thank you in advance.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    01-09-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: VBA Code to return data if within X amount of hours

    Nevermind I think I found an answer using excel formulas.

    I just used =C2=MEDIAN(C2,Ref!$AD$1:$AE$1) which tells me if the time is between X amount (whatever the user inputs), then based off that True or False result, used Sumifs to total the amount.

    Thanks anyways

+ 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: 1
    Last Post: 04-07-2011, 06:15 PM
  2. Turning a set amount of hours into days
    By yeahetc in forum Excel General
    Replies: 1
    Last Post: 04-24-2009, 09:54 AM
  3. index row, return dollar amount adding amount together
    By desk.doc in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-27-2007, 12:11 PM
  4. How do I find the amount of hours between 6:00 PM to 12:30 AM?
    By Gene Mah in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-15-2005, 05:05 PM
  5. [SOLVED] How do I find the amount of hours between times?
    By gormanj in forum Excel General
    Replies: 1
    Last Post: 05-04-2005, 08:06 AM

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