Help with multiple IF statement

Kayslover

Board Regular
Joined
Sep 22, 2020
Messages
168
Office Version
  1. 2013
Platform
  1. Windows
Hi all,

I am using Excel 2013.

I have the following formula in cell N3

Rich (BB code):
=IF(AND(M3="Weekday",L3<=5),200,L3*B3*24)

How can I expand it so that if M3 contains “Weekend” and L3<=5 I would like the cell to be populated with 300 otherwise populate it with L3*B3*24

I have tried
Rich (BB code):
=IF(AND(M3="Weekday",L3<=5),200,L3*B3*24),IF(AND(M3="Weekend",L3<=5),300,L3*B3*24)
and I get #VALUE! displayed in N3

Your assistance will be appreciated.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
How about
Excel Formula:
=IF(AND(M3="Weekday",L3<=5),200,IF(AND(M3="Weekend",L3<=5),300,L3*B3*24))
 
Upvote 0
Fluff,

Thank you for the prompt response and apologies for my delay in responding (have been tied up with other things)

Having used your revised formula I have run into a problem as I did not explain myself correctly.

Basically you have said use the following in CellNn:-

Rich (BB code):
=IF(AND(I3="Weekday",M3<=5),200,IF(AND(I3="Weekend",M3<=5),300,M3*B3*24))

What I would like is the following in Cell Nn

Rich (BB code):
=IF(AND(I2="Weekday",M2<=5),200,M2*B2*24),(IF(AND(I2="Weekend",M2<=5),300,M2*B2*24)).

However, when I use my formula it returns #VALUE! In cell. Is there a way to modify my formula to achieve what I want?

I attach XL2BB which should hopefully be more helpful by looking at the comments in Cell Rn

Hall Hire Calculations.xlsx
ABCDEFGHIJKLMNOPQR
1Customer NameHourly RateTable Cloth CostDeposit AmountKitchen RequiredKitchen HireSoft Drinks CorkageDay of the weekWeekend/WeekdayDate Of EventTime InTime OutTotal no of hoursHall Hire CostNo of Table ClothsTable Cloth TotalTotal AmountComments
2Customer 1£50.00£3.00£100.00N£0.00£0.00MonWeekday10/01/202216:3020:304:00#VALUE!0£0.00#VALUE!As I2 is Weekday and M2 is less than =5, N2 is correct as £200
3Customer 2£50.00£3.00£100.00N£0.00£0.00TueWeekday11/01/202218:3023:305:00£200.000£0.00£200.00As I3 is Weekday and M3 less than =5, then N3 is correct as £200
4Customer 3£50.00£3.00£100.00N£0.00£0.00WedWeekday12/01/202218:0023:305:30£200.000£0.00£200.00As I4 is Weekday and M4 greater than =5, then N4 should be M4*B4*24=(£275)
5Customer 4£50.00£3.00£100.00N£0.00£0.00ThuWeekday13/01/202215:0000:009:00£200.000£0.00£200.00As I5 is Weekday and M5 greater than =5, then N5 should be M5*B5*24=(£450.00)
6
7Customer 5£50.00£3.00£100.00N£0.00£0.00FriWeekend14/01/202220:0023:003:00£300.000£0.00£300.00As I7 is Weekend and M7 is less than =5, N7 is correct as £300
8Customer 6£50.00£3.00£100.00N£0.00£0.00SatWeekend15/01/202218:3023:305:00£300.000£0.00£300.00As I8 is Weekend and M8 is less than =5, N8 is correct as £300
9Customer 7£50.00£3.00£100.00N£0.00£0.00SunWeekend16/01/202218:0023:305:30£300.000£0.00£300.00As I9 is Weekend and M9 greater than =5, then N9 should be M9*B9*24=(£275)
10Customer 8£50.00£3.00£100.00N£0.00£0.00SunWeekend16/01/202215:0000:009:00£300.000£0.00£300.00As I10 is Weekend and M10 greater than =5, then N10 should be M10*B10*24=(£450.00)
Master
Cell Formulas
RangeFormula
B7:B10,B2:B5B2=Lookup!$B$2
C7:C10,C2:C5C2=Lookup!$B$4
H7:H10,H2:H5H2=TEXT(J2,"ddd")
I7:I10,I2:I5I2=IF(OR(H2="Fri",H2="Sat",H2="Sun"),"Weekend","Weekday")
M8,M2:M4M2=L2-K2
N2N2=IF(AND(I2="Weekday",M2<=5),200,M2*B2*24),(IF(AND(I2="Weekend",M2<=5),300,M2*B2*24))
N7:N10,N3:N5N3=IF(AND(I3="Weekday",M3<=5),200,IF(AND(I3="Weekend",M3<=5),300,M3*B3*24))
M5,M9:M10,M7M5=(L5-K5)
P7:P10,P2:P5P2=O2*C2
Q7:Q10,Q2:Q5Q2=N2+P2+F2+G2
F7:F10,F2:F5F2=IF(E2="Y",Lookup!$B$6,0)
 
Upvote 0
What is wrong with the formula I suggested?
 
Upvote 0
Fluff,

I will come back to you to tomorrow? I have just got a call from my Mrs to go and pick her up as it raining.
 
Upvote 0
Fluff.

What is working is:-

Rich (BB code):
If In = "Weekend" and Mn <= 5, then the formula Nn is being populated with 200 as anticipated.

If In = "Weekday" and Mn <= 5, then the formula Nn is being populated with 300 as anticipated.

What isn’t working is:-

Rich (BB code):
If In = "Weekend" and Mn > 5, then the formula Mn*Bn*24 is not being applied.

If In = "Weekday" and Mn > 5, then the formula Mn*Bn*24 is not being applied.

I have never been able to do nested If statements in Excel, in my old programming days of programming mainframes, I would have used something like this to achieve what I am requesting:-

Code:
If In = “Weekday” Then
    If Mn <= 5 Then
        Nn= 200
    Else
        Nn= Mn*Bn3*24
    Endif
Else
    If Mn <= 5 Then
        Nn = 300
    Else
        Nn= Mn*Bn3*24
    Endif
Endif

I hope you don't take any offence with the coding I have supplied to achieve what I want the end result to be.

Thanks for your assistance so far.
 
Upvote 0
The problem is that col M are time values & will therefore always be less than 5.
Try
Excel Formula:
=IF(AND(I2="Weekday",M2<=TIME(5,0,0)),200,IF(AND(I2="Weekend",M2<=TIME(5,0,0)),300,M2*B2*24))
 
Upvote 0
Solution
Fluff,

Your revised formula worked a treat.

I really appreciate your kind assistance.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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