combine 2 formula

tonym07

New Member
Joined
Jul 22, 2019
Messages
9
Hello

I am trying to combine 2 formula but have difficulty as i do not understand excel that well, these are the 2 formula below

1st =IF(IFERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0),0)=TEXT(B3,"dd/mm/yyyy"),"off Peak"

2nd =IFERROR(IF((LEFT(TEXT(B3,"ddd"))="S")+ISNUMBER(MATCH(INT(B3),$L$3:$L$10,0)), LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak";"Off peak";"Off Peak";"Off peak"}),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak";"Off peak";"Peak";"Peak";"Peak";"Off peak"})),"")

So from 1st formula then add second formula from lookup on wards which has a space is what i need

this is for peak and off peak times with holiday in a separate worksheet

any help would be appreciated

thank you
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If they both work as you expect then put a comma on the end of the first and add the 2nd to it minus the equals sign and add a close bracket to the end of the whole lot.
 
Upvote 0
If they both work as you expect then put a comma on the end of the first and add the 2nd to it minus the equals sign and add a close bracket to the end of the whole lot.


Hello Steve the fish

For example this is the formula i need

=IF(IFERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0),0)=TEXT(B3,"dd/mm/yyyy"),"off Peak",LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak";"Off peak";"Off Peak";"Off peak"}),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak";"Off peak";"Peak";"Peak";"Peak";"Off peak"})),"")

it say you have entered to many arguments for this function ,
 
Upvote 0
What's this part supposed to be doing?

LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak";"Off peak";"Off Peak"})

It will ALWAYS return "Off Peak" regardless of the value in B3.
You can just return the value of "Off Peak", no need for a LOOKUP() at all.

And why are there two types of return value, "Off peak" and "Off Peak" (Note capital P) ?
Is that a typo? If so just return "Off Peak" as specified above, no nedd for LOOKUP.
 
Upvote 0
Maybe see if this works:

=IF(ISERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0)),IFERROR(IF((LEFT(TEXT(B3,"ddd"))="S")+ISNUMBER(MATCH(INT(B3),$L$3:$L$10,0)),"Off peak",LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak","Off peak","Peak","Peak","Peak","Off peak"})),""),"Off Peak")
 
Upvote 0
What's this part supposed to be doing?

LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak";"Off peak";"Off Peak"})

It will ALWAYS return "Off Peak" regardless of the value in B3.
You can just return the value of "Off Peak", no need for a LOOKUP() at all.

And why are there two types of return value, "Off peak" and "Off Peak" (Note capital P) ?
Is that a typo? If so just return "Off Peak" as specified above, no nedd for LOOKUP.

Hello Special-K99

The formula is supposed to be universal as in Victoria Australia there is peak and off peak and some do shoulder as well in different times , so what i can do with this formula is change the peak,off peak, and shoulder arrangement and also the times that they are at , just say i went with a different retailer they could be different , so the formula i gave was just peak and off peak only thats why you see it was all off peak and that part was for weekend the other part weekday ,

Yes the capital P yes it is just a typo

Thank you Special-K99

As i am buying from National Electricity market
 
Upvote 0
Maybe see if this works:

=IF(ISERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0)),IFERROR(IF((LEFT(TEXT(B3,"ddd"))="S")+ISNUMBER(MATCH(INT(B3),$L$3:$L$10,0)),"Off peak",LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak","Off peak","Peak","Peak","Peak","Off peak"})),""),"Off Peak")



Hello Steve the Fish


Thank you that worked ,

How do you know which one is for the weekend just say on the weekend shoulder from 10am-7pm how could i modify the formula?
 
Upvote 0
Judging by what you said before then its this:

=IF(ISERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0)),IFERROR(IF((LEFT(TEXT(B3,"ddd"))="S")+ISNUMBER(MATCH(INT(B3),$L$3:$L$10,0)),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak","Off peak","Off Peak","Off peak"}),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak","Off peak","Peak","Peak","Peak","Off peak"})),""),"Off Peak")

The part in red is produced if the date is a weekend and/or is present within L3:L10.
 
Upvote 0
Judging by what you said before then its this:

=IF(ISERROR(VLOOKUP(TEXT(B3,"dd/mm/yyyy"),Holidays!A:A,1,0)),IFERROR(IF((LEFT(TEXT(B3,"ddd"))="S")+ISNUMBER(MATCH(INT(B3),$L$3:$L$10,0)),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","23:30"},{"Off peak","Off peak","Off Peak","Off peak"}),LOOKUP(TEXT(B3,"hh:mm"),{"00:00","00:30","07:30","14:30","20:30","22:30"},{"Off peak","Off peak","Peak","Peak","Peak","Off peak"})),""),"Off Peak")

The part in red is produced if the date is a weekend and/or is present within L3:L10.


Thank you Steve the fish that worked,

thank you for your help +1

Much appreciated
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
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