Newbie987654321

New Member
Joined
Mar 13, 2018
Messages
9
Hi Guys,

I need your help. I need to know how many artists in total are in within a time range.
I need a formula to put into table 2 to get the number of artists. I just did this manually. LOL
I tried SUMPRODUCT but it will only give me the number on artists on based on their Time In, but I actually need the total number of artist until their Time Out.

I tried this but it was no good.
=SUMPRODUCT(--(HOUR($E$3:$E$18)>=H3),--(HOUR($E$3:$E$18)<i3))


Here's the table.

TABLE 1
TABLE 2
Artist
Time in
Time Out
Time in Duration
Artists
Sam Smith
9:00 PM
6:00 AM
9:00 PM
9:30 PM
2
Justin Bieber
9:00 PM
6:00 AM
9:30 PM
10:00 PM
3
Selena Gomez
9:30 PM
6:30 AM
10:00 PM
10:30 PM
4
Britney Spears
10:00 PM
7:00 AM
10:30 PM
11:00 PM
5
Christina Aguilera
10:45 PM
7:45 AM
11:00 PM
11:30 PM
5
Elle King
11:45 PM
8:45 AM
11:30 PM
12:00 AM
7
Miley Cyrus
11:45 PM
8:45 AM
12:00 AM
12:30 AM
8
Angelina Jolie
12:00 AM
9:00 AM
12:30 AM
1:00 AM
8
Brad Pitt
1:00 AM
10:00 AM
1:00 AM
1:30 AM
9
Justin Timberlake
2:00 AM
11:00 AM
1:30 AM
2:00 AM
9
Pink
3:00 AM
12:00 PM
2:00 AM
2:30 AM
10
Amy Lee
3:00 AM
12:00 PM
2:30 AM
3:00 AM
10
3:00 AM
3:30 AM
12
3:30 AM
4:00 AM
12
4:00 AM
4:30 AM
12
4:30 AM
5:00 AM
12
5:00 AM
5:30 AM
12
5:30 AM
6:00 AM
12
6:00 AM
6:30 AM
10
6:30 AM
7:00 AM
9
7:00 AM
7:30 AM
8
7:30 AM
8:00 AM
7
8:00 AM
8:30 AM
7
8:30 AM
9:00 AM
5
9:00 AM
9:30 AM
4
9:30 AM
10:00 AM
4
10:00 AM
10:30 AM
3
10:30 AM
11:00 AM
3
11:00 AM
11:30 AM
2
11:30 AM
12:00 PM
2

<tbody>
</tbody>
</i3))
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
The reason that SUMPRODUCT would not work as is in this instance is that excel does not realize that the morning hours, should still fall within the appropriate range (i.e. Hour(9PM) = 21, Hour(1AM) = 1). You can try to incorporate a date in with the time that way the values are going in a continuous order or have some hidden rows to do such a calculation.
 
Upvote 0
Hi!

Maybe the formula below can helps:

In G4 and copy down

=SUMPRODUCT(--(B$4:B$15<=E4),--(F4<=B$4:B$15+MOD(C$4:C$15-B$4:B$15,1)))


ABCDEFGH
1
2
3ArtistTime inTime OutTime in DurationArtists
4Sam Smith21:0006:0021:0021:302
5Justin Bieber21:0006:0021:3022:003
6Selena Gomez21:3006:3022:0022:304
7Britney Spears22:0007:0022:3023:004
8Christina Aguilera22:4507:4523:0023:305
9Elle King23:4508:4523:3024:005
10Miley Cyrus23:4508:4500:0000:301
11Angelina Jolie00:0009:0000:3001:001
12Brad Pitt01:0010:0001:0001:302
13Justin Timberlake02:0011:0001:3002:002
14Pink03:0012:0002:0002:303
15Amy Lee03:0012:0002:3003:003
1603:0003:305
1703:3004:005
1804:0004:305
1904:3005:005
2005:0005:305
2105:3006:005
*********************************************************************

<tbody>
</tbody>


Markmzz
 
Upvote 0
Hi Mark, I appreciate your help on this. It's almost there however the 23:45 should be counted within the 22:30-23:00 time range. And so far, the numbers are different from the table 2 results I was looking for. By the way, the columns E and F is the range for Time In.
So basically, from 9PM to 3AM, the number of artists should gradually increase, then by 6AM onwards it goes down as some of them times out.
 
Upvote 0
Hi Mark, I appreciate your help on this. It's almost there however the 23:45 should be counted within the 22:30-23:00 time range. And so far, the numbers are different from the table 2 results I was looking for. By the way, the columns E and F is the range for Time In.
So basically, from 9PM to 3AM, the number of artists should gradually increase, then by 6AM onwards it goes down as some of them times out.

Hi!

I'm sorry but I didn't understand what you want.

Could you explain better? With more examples.

Why 23:45 shoud be counted for the range 22:30 to 23:00?

Markmzz
 
Upvote 0
Hi!

I'm sorry but I didn't understand what you want.

Could you explain better? With more examples.

Why 23:45 shoud be counted for the range 22:30 to 23:00?

Markmzz


Hi. Sorry for thr confusion, i meant 22:45 should be counted on a 2230-2300 time in range. With that, I mean Time In Duration 2230-2300 should be 5.
Then by 3am all artists should be there since the last artist comes in at 3am. So 0300-330 should be 12 until 6am.
The around 0600-0630, since 2 artists times out it should then decrease to 10. and so forth.
 
Upvote 0
Hi. Sorry for thr confusion, i meant 22:45 should be counted on a 2230-2300 time in range. With that, I mean Time In Duration 2230-2300 should be 5.
Then by 3am all artists should be there since the last artist comes in at 3am. So 0300-330 should be 12 until 6am.
The around 0600-0630, since 2 artists times out it should then decrease to 10. and so forth.

Hi!

I'm sorry, but I don't know how do that until now.

I think that Iggy_ (post #2) is right. We need to incorporate a date.

Anyway, lets wait for another user.

Ps: If I have another suggestion, I'll post here again.

Markmzz
 
Upvote 0
Hi!

Anyway, here is my formula with Iggy_ (post #2) sugestion:


ABCDEFGH
1
2
3ArtistTime inTime OutTime in DurationArtists
4Sam Smith21:00:0006:00:0021:00:0021:30:002
5Justin Bieber21:00:0006:00:0021:30:0022:00:003
6Selena Gomez21:30:0006:30:0022:00:0022:30:004
7Britney Spears22:00:0007:00:0022:30:0023:00:004
8Christina Aguilera22:45:0007:45:0023:00:0023:30:005
9Elle King23:45:0008:45:0023:30:0000:00:005
10Miley Cyrus23:45:0008:45:0000:00:0000:30:008
11Angelina Jolie00:00:0009:00:0000:30:0001:00:008
12Brad Pitt01:00:0010:00:0001:00:0001:30:009
13Justin Timberlake02:00:0011:00:0001:30:0002:00:009
14Pink03:00:0012:00:0002:00:0002:30:0010
15Amy Lee03:00:0012:00:0002:30:0003:00:0010
1603:00:0003:30:0012
1703:30:0004:00:0012
1804:00:0004:30:0012
1904:30:0005:00:0012
2005:00:0005:30:0012
2105:30:0006:00:0012
2206:00:0006:30:0010
2306:30:0007:00:009
2407:00:0007:30:008
2507:30:0008:00:007
2608:00:0008:30:007
2708:30:0009:00:005
2809:00:0009:30:004
2909:30:0010:00:004
3010:00:0010:30:003
3110:30:0011:00:003
3211:00:0011:30:002
3311:30:0012:00:002
34
*********************************************************************

<tbody>
</tbody>


Markmzz
 
Upvote 0

Forum statistics

Threads
1,216,038
Messages
6,128,447
Members
449,453
Latest member
jayeshw

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