Calculate band on Hours/Time passed

farhan11941234

New Member
Joined
Dec 14, 2019
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Please help me out to figure out a formula to calculate Date/Time Base Bins (See attached Image).Whenever The ID Creation(Column A) on Current Day and Time 3:00 PM to 6:00 PM, In Column C "> 3 to 6 PM" , Current Date and time between 6 to 7 PM in Column C result should be " > 6 to 7 PM", after 7:00 PM , in Column C should be "> 7:00 PM onwards.
when time > 14 Hours it should be >14 Hours and continue the this logic to >24 and >48 hours.
I would be very thankful to help me devolope the formula for this.

Sorry, for not using the XL2BB becuase of the admin Limitations.

Thanks
 

Attachments

  • Sample.jpg
    Sample.jpg
    98.4 KB · Views: 42

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
That is you opinion, IMO there are lots of reason to NOT use tables.
That is not just my opinion, it's a fact.
  • A fact that using Table references make a formula much clearer.
  • A fact that as data is added to a Table the ranges grow with it.
If it's just a straight table with rows and columns of data, not taking advantage of Excel's Table feature is not something that someone who considers accuracy would do.

The only reasons to NOT use a table is the format does not lend itself to a Table format - as in Financial Statements, OR when a Spilled Array is used as it cannot be used in an Excel Table.

I was just trying to point out GOOD Excel practice. The opinion that there are "LOTS" of reasons is misguiding, and as the audience tends to have less experience, I think it's better to advocate good practices.

But go ahead, list your "LOTS" of reasons. I'm interested in seeing them.
 
Upvote 0
Snapshot attached of the formula, Please suggest if the same can be acheived without using XLOOKUP for older version of Excel.
 

Attachments

  • SS.jpg
    SS.jpg
    144.1 KB · Views: 10
Upvote 0
Snapshot attached of the formula, Please suggest if the same can be acheived without using XLOOKUP for older version of Excel.
VLOOKUP will do the same thing, it's just a bit more cumbersome to use. INDEX/MATCH will also work.
 
Upvote 0
Time.xlsm
ABCDEF
1Time StampHoursTimeCategory
214-Dec-22 0:1238.8Midnight to 3 AM0Midnight to 3 AM
314-Dec-22 3:2735.63 AM to 6 AM03:003 AM to 6 AM
413-Dec-22 17:2345.73 PM to 6 PM06:006 AM to 9 AM
514-Dec-22 4:4834.23 AM to 6 AM09:009 AM to Noon
613-Dec-22 17:3745.43 PM to 6 PM12:00Noon to 3 PM
714-Dec-22 5:2233.73 AM to 6 AM15:003 PM to 6 PM
814-Dec-22 13:5625.1Noon to 3 PM18:006 PM to 9 PM
913-Dec-22 6:0051.63 AM to 6 AM21:009 PM to Midnight
10
10d
Cell Formulas
RangeFormula
D2:D9D2=LOOKUP(MOD(A2,1),$E$2:$F$9)


VLookup
Time.xlsm
ABCDEF
1Time StampHoursTimeCategory
214-Dec-22 0:1238.8Midnight to 3 AM0Midnight to 3 AM
314-Dec-22 3:2735.63 AM to 6 AM03:003 AM to 6 AM
413-Dec-22 17:2345.73 PM to 6 PM06:006 AM to 9 AM
514-Dec-22 4:4834.23 AM to 6 AM09:009 AM to Noon
613-Dec-22 17:3745.43 PM to 6 PM12:00Noon to 3 PM
714-Dec-22 5:2233.73 AM to 6 AM15:003 PM to 6 PM
814-Dec-22 13:5625.1Noon to 3 PM18:006 PM to 9 PM
913-Dec-22 6:0051.63 AM to 6 AM21:009 PM to Midnight
10
10d
Cell Formulas
RangeFormula
D2:D9D2=VLOOKUP(MOD(A2,1),$E$2:$F$9,2,1)
 
Upvote 0
I finally got it! Three versions too.
Book1
GIJKLMN
1Time StampXcatVcatIcatTimeCategory
212/14/22 12:12 AMMidnight to 3 AMMidnight to 3 AMMidnight to 3 AM12:00:00 AMMidnight to 3 AM
312/13/22 3:33 PM3 PM to 6 PM3 PM to 6 PM3 PM to 6 PM02:59:00 AMMidnight to 3 AM
412/14/22 7:56 AM6 AM to 9 AM6 AM to 9 AM6 AM to 9 AM03:00:00 AM3 AM to 6 AM
512/13/22 6:08 PM6 PM to 9 PM6 PM to 9 PM6 PM to 9 PM05:59:00 AM3 AM to 6 AM
612/13/22 6:59 PM6 PM to 9 PM6 PM to 9 PM6 PM to 9 PM06:00:00 AM6 AM to 9 AM
712/13/22 9:38 AM9 AM to Noon9 AM to Noon9 AM to Noon08:59:00 AM6 AM to 9 AM
812/13/22 1:48 AMMidnight to 3 AMMidnight to 3 AMMidnight to 3 AM09:00:00 AM9 AM to Noon
912/14/22 3:27 AM3 AM to 6 AM3 AM to 6 AM3 AM to 6 AM11:59:00 AM9 AM to Noon
1012/13/22 5:23 PM3 PM to 6 PM3 PM to 6 PM3 PM to 6 PM12:00:00 PMNoon to 3 PM
1112/14/22 4:48 AM3 AM to 6 AM3 AM to 6 AM3 AM to 6 AM02:59:00 PMNoon to 3 PM
1212/13/22 5:37 PM3 PM to 6 PM3 PM to 6 PM3 PM to 6 PM03:00:00 PM3 PM to 6 PM
1312/13/22 2:25 PMNoon to 3 PMNoon to 3 PMNoon to 3 PM05:59:00 PM3 PM to 6 PM
1412/14/22 11:16 PM9 PM to Midnight9 PM to Midnight9 PM to Midnight06:00:00 PM6 PM to 9 PM
1512/13/22 12:14 PMNoon to 3 PMNoon to 3 PMNoon to 3 PM08:59:00 PM6 PM to 9 PM
1612/14/22 11:20 AM9 AM to Noon9 AM to Noon9 AM to Noon09:00:00 PM9 PM to Midnight
1712/14/22 5:22 AM3 AM to 6 AM3 AM to 6 AM3 AM to 6 AM11:59:00 PM9 PM to Midnight
1812/14/22 1:56 PMNoon to 3 PMNoon to 3 PMNoon to 3 PM
1912/13/22 11:26 AM9 AM to Noon9 AM to Noon9 AM to Noon
2012/14/22 7:58 AM6 AM to 9 AM6 AM to 9 AM6 AM to 9 AM
2112/14/22 10:31 PM9 PM to Midnight9 PM to Midnight9 PM to Midnight
Sheet2
Cell Formulas
RangeFormula
I2:I21I2=XLOOKUP(TIME(HOUR(G2),MINUTE(G2),0),TimeCats[Time],TimeCats[Category],"#####",1)
J2:J21J2=VLOOKUP(TIME(HOUR([@[Time Stamp]]),MINUTE([@[Time Stamp]]),0),TimeCats,2)
K2:K21K2=INDEX(TimeCats[Category],MATCH(TIME(HOUR([@[Time Stamp]]),MINUTE([@[Time Stamp]]),0),TimeCats[Time],1))

I looked at this using a sequence of 288 five minute time intervals with all 3 formulas, and it worked there too. Of note, INDEX-MATCH did NOT like a spilled array!
Anyway, hope that does it!
 
Upvote 0
Time.xlsm
ABCDEF
1Time StampHoursTimeCategory
214-Dec-22 0:1238.8Midnight to 3 AM0Midnight to 3 AM
314-Dec-22 3:2735.63 AM to 6 AM03:003 AM to 6 AM
413-Dec-22 17:2345.73 PM to 6 PM06:006 AM to 9 AM
514-Dec-22 4:4834.23 AM to 6 AM09:009 AM to Noon
613-Dec-22 17:3745.43 PM to 6 PM12:00Noon to 3 PM
714-Dec-22 5:2233.73 AM to 6 AM15:003 PM to 6 PM
814-Dec-22 13:5625.1Noon to 3 PM18:006 PM to 9 PM
913-Dec-22 6:0051.63 AM to 6 AM21:009 PM to Midnight
10
10d
Cell Formulas
RangeFormula
D2:D9D2=LOOKUP(MOD(A2,1),$E$2:$F$9)


VLookup
Time.xlsm
ABCDEF
1Time StampHoursTimeCategory
214-Dec-22 0:1238.8Midnight to 3 AM0Midnight to 3 AM
314-Dec-22 3:2735.63 AM to 6 AM03:003 AM to 6 AM
413-Dec-22 17:2345.73 PM to 6 PM06:006 AM to 9 AM
514-Dec-22 4:4834.23 AM to 6 AM09:009 AM to Noon
613-Dec-22 17:3745.43 PM to 6 PM12:00Noon to 3 PM
714-Dec-22 5:2233.73 AM to 6 AM15:003 PM to 6 PM
814-Dec-22 13:5625.1Noon to 3 PM18:006 PM to 9 PM
913-Dec-22 6:0051.63 AM to 6 AM21:009 PM to Midnight
10
10d
Cell Formulas
RangeFormula
D2:D9D2=VLOOKUP(MOD(A2,1),$E$2:$F$9,2,1)
Excel Formula:
LOOKUP(MOD(A2,1)
Sweet!
 
Upvote 0
Thanks for other versions, but Vlookup and lookup version not working for me for unknown reason. I am trying to figure it why VLOOKUP is not working.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top