force a letter to a certain time

elynoy

Board Regular
Joined
Oct 29, 2018
Messages
160
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hello. The tittle is wierd because I'm not sure how to call it.

I have a sheet that allows me to choose night shift times for some cells. and based on the time I put there it gives me more or less night hours worked

I need to know if I can make, for exemple, be able to choose the time i want for each person in an interval of cells.

Night time shiftnightday
A21:0006:0016:0024:00:00A35
B20:0007:0016:0024:00:00B44

<tbody>
</tbody>

Let me try to explain: the letter A should be able to choose between those 2 shifts and so should be the letter B.
And in the range of cells given let's say A1 to C10, everytime that letter appears it should count the amount of hours for that letter with that specific shift.


best regards,
eLY
 
Last edited:
So is this as "simple" as taking the number in the "night" column, and then multiplying that number by the number of "a"s or "b"s ?

If yes, please post a sample of what your data would ideally look like, if you could get it all on one row.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I'm not sure if it's just that since I got that already, but since it multiplys by the value "night" in the example it uses that value for that row, no matter the letter it have. I had it like that but then I noticed that problem since all the letters in that row would all use the same"night shift" and not the one I want for each letter.

eLy
 
Upvote 0
Sorry, I still don't understand what you want.

Can you please post SEVERAL lines of data - say half a dozen, not just one ?
Make sure that they all contain DIFFERENT data from each other.
Give the results that you want for each line please.
 
Upvote 0
I'll try my best:

<colgroup><col><col><col><col span="2"><col><col><col span="2"><col span="2"><col><col span="3"><col><col span="5"></colgroup><tbody></tbody>
ABCDEFG
1nightdaytotalinout21:0006:00
209:0003:0012:0020:0008:00
3A2=
C2-B2
B2=
(($D2>$E2)*MED(0;$E2-$G$1;MED($G$1;$F$1))+MÁXIMO(0;MÍNIMO($F$1;$E2+($D2>$E2))-MÁXIMO(1/4;$D2)))
C2=
=RESTO(E2-D2;1)

<tbody>
</tbody>


Now, based on the example above I have this

ABCDEFGHIJKL
1nightdaytotalinoutNight hours for letter A
209:0003:0012:0020:0008:00aaa27
3I2=
(CONTAR.SE(F2:H2;"A")*A2)

<tbody>
</tbody>


But I' need to be like this:

ABCDEFGHIJKL
1nightdaytotalinoutNight hours for letter ANight hours for letter B
209:0003:0012:0020:0008:00aba189
3I2=
(CONTAR.SE(F2:H2;"A")*A2)
J2=
(CONTAR.SE(F2:H2;"B")*A2)

<tbody>
</tbody>


But: I need the letter B to have a different time from that exemple as night shift:

ABCDEFG
1nightdaytotalinout20:0007:00
211:0001:0012:0020:0008:00
3A2=
C2-B2
B2=
(($D2>$E2)*MED(0;$E2-$G$1;MED($G$1;$F$1))+MÁXIMO(0;MÍNIMO($F$1;$E2+($D2>$E2))-MÁXIMO(1/4;$D2)))
C2=
=RESTO(E2-D2;1)

<tbody>
</tbody>



So I need it to be like this example. It's in different rows because it's the way found as a workaround the problem, but I need them to be on the same row:

ABCDEFGHIJKL
1nightdaytotalinoutNight hours for letter ANight hours for letter B
209:0003:0012:0020:0008:00aa1811
311:0001:0012:0020:0008:00bI2=
(CONTAR.SE(F2:H2;"A")*A2)
J2=
(CONTAR.SE(F3:H3;"B")*A3)

<tbody>
</tbody>


Thats why I say "force to the letter" because letter A has the night shift from 21:00 to 06:00 and letter B has a night shift from 20:00to 07:00.

I hope this helps because if it doesnt, I dont know how to explain better than this and I'll simply keep doing the way I've been doing till now but with it's inconvenient of using too many rows.

Thanks for your help anyways.

Best regards,
eLy
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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