Work schedule

Niekb22

New Member
Joined
Jun 7, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

currently I am working on an workschedule.
But unfortunatly i cant figure out how to program a case structure wich compares letters.

So every letters represents a number of working hours.
for example M stands for morning and represents 4 hours of work.

I tried a function wich compares the current value with the letters.
someting like this.

Function hourscal(Hours as string) ' for comparing a letter I used a string
dim totalhour As integer


select case hours

Case hours = M

Totalhours = value + 4

How can make a case structure like this?

thanks in advance

Niek



1623081665288.png

wat is
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How many hours of work are represented by each of the letters?
 
Upvote 0
Hi & welcome to MrExcel.
Why not just use a formula?
+Fluff 1.xlsm
GHIJKLMNOPQR
1
2MMMM MMM28
3AAMAAMF32
Master
Cell Formulas
RangeFormula
R2:R3R2=SUM(SWITCH(G2:Q2,"M",4,"A",4,"F",8,0))
 
Upvote 0
Solution
Hi & welcome to MrExcel.
Why not just use a formula?
+Fluff 1.xlsm
GHIJKLMNOPQR
1
2MMMM MMM28
3AAMAAMF32
Master
Cell Formulas
RangeFormula
R2:R3R2=SUM(SWITCH(G2:Q2,"M",4,"A",4,"F",8,0))

Wow, was thinking way to hard
Thank you
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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