Change from Hour to hour and minute

tonym07

New Member
Joined
Jul 22, 2019
Messages
9
Hello

Im new to excel and wondering would it be possible to change the hour formula to hour and minute?

example first column which has hour {0;7;22} can it be changed to {0:30;7:30:22:30} as in the energy market it always starts at 7:30 not 7 for example,



LOOKUP(HOUR(B2),{0;7;22},{"Off peak";"Shoulder";"Off peak"}),LOOKUP(HOUR(B2),{0;7;14;20;22},{"Off peak";"Shoulder";"Peak";"Shoulder";"Off peak"})),"")



Thank you
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
This formula generates an error.

You can't have

LOOOKUP(...),LOOKUP()

This appears to be part of a longer formula.
Please post the complete formula.
 
Last edited:
Upvote 0
This formula generates an error.

You can't have

LOOOKUP(...),LOOKUP()

This appears to be part of a longer formula.
Please post the complete formula.



Sorry yes it is a longer formula

=IFERROR(IF((LEFT(TEXT(B2,"ddd"))="S")+ISNUMBER(MATCH(INT(B2),$D$2:$D$14,0)),LOOKUP(HOUR(B2),{0;7;22},{"Off peak";"Shoulder";"Off peak"}),LOOKUP(HOUR(B2),{0;7;14;20;22},{"Off peak";"Shoulder";"Peak";"Shoulder";"Off peak"})),"")
 
Upvote 0
Try

=IFERROR(IF((LEFT(TEXT(B2,"ddd"))="S")+ISNUMBER(MATCH(INT(B2),$D$2:$D$14,0)),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Off peak"}),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","14:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Peak";"Shoulder";"Off peak"})),"")
 
Last edited:
Upvote 0
Try

=IFERROR(IF((LEFT(TEXT(B2,"ddd"))="S")+ISNUMBER(MATCH(INT(B2),$D$2:$D$14,0)),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Off peak"}),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","14:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Peak";"Shoulder";"Off peak"})),"")

Thank you for your help

Just couple of thing 20:30 has peak when it should be Shoulder and from 22:30 has Shoulder when it should be off peak

thank you so much for your help

1/10/2019 20:30 Peak Shoulder
1/10/2019 21:00 Peak Shoulder
1/10/2019 21:30 Peak Shoulder
1/10/2019 22:00 Peak Shoulder
1/10/2019 22:30 Shoulder Off peak
1/10/2019 23:00 Shoulder Off peak
1/10/2019 23:30 Shoulder Off peak
 
Upvote 0
Hello Special-K99

I found the error

=IFERROR(IF((LEFT(TEXT(B2,"ddd"))="S")+ISNUMBER(MATCH(INT(B2),$D$2:$D$14,0)),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Off peak"}),LOOKUP(TEXT(B2,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak";"Off peak";"Shoulder";"Peak";"Shoulder";"Off peak"})),"")

20:30 was missing so i added it and all is ok formula works now ,

thank you so much
:)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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