IF Statements Trouble

scotty1978

New Member
Joined
Dec 17, 2023
Messages
13
Office Version
  1. 365
Platform
  1. MacOS
Trying to create an IF formula which is a little tricky, hoping to get some help.

Here are conditions:

IF B2*1 is less than or equal to D2 , then show Text D2. If B2*1 is greater than or equal to D2, then show Text D3. If B2*1 is greater than or equal to B4, then show Text D4.

The formula will then repeat itself below B2*2, B2*3, B2*4 in the corresponding cells below down the line. I'm not too concerned about that. If there is a formula that works for the example above, I can make those adjustments.

Thanks in advance

Screenshot 2023-12-19 at 4.32.14 PM.png
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Is this what you're looking for?

Excel Formula:
=IF(B2*1>=B4,D4,IF(B2*1<=D2,D2,IF(B2*1>=D2,D3)))
 
Upvote 0
If B2*1 is greater than or equal to D2, then show Text D3. If B2*1 is greater than or equal to B4, then show Text D4.
What happens when you increase the multiple to 20, and B2 * 20 is greater than D2 and greater than B4?

Or did you perhaps mean: If B2*1 is greater than or equal to D3, then show Text D4?
 
Upvote 0
Is this what you're looking for?

Excel Formula:
=IF(B2*1>=B4,D4,IF(B2*1<=D2,D2,IF(B2*1>=D2,D3)))
Thank you! I realized after the fact that I did a really poor job in explaining. I tried to simplify things from worksheet I'm using and realized I provided the wrong info. I have attached a new image which has the exact placement on my worksheet and a better description (I hope) ;). Any help would be appreciate. Also, below Stephen raises a great point that I experienced when playing around with your formula. Once the numbers increase, for example Y1*20, Y*21, etc... #SPILL error occurs. Any solution to this would be greatly appreciated. This thing is driving me crazy and appreciate all the help.
Screenshot 2023-12-20 at 8.25.38 AM.png

Is this what you're looking for?

Excel Formula:
=IF(B2*1>=B4,D4,IF(B2*1<=D2,D2,IF(B2*1>=D2,D3)))
 
Upvote 0
What happens when you increase the multiple to 20, and B2 * 20 is greater than D2 and greater than B4?

Or did you perhaps mean: If B2*1 is greater than or equal to D3, then show Text D4?
Thank you for your feedback. You raised an excellent point and I tried to do a better job explaining my scenario in the post above in response to Skrej. The spill error will still occur in this scenario and hoping for a solution. Thanks again!
 
Upvote 0
So perhaps this is closer?

STUVWXY
11100DR100
22200Ded1000
33300OP2000
44400PC400
55500
66600
77700
88800
99900
10101000
1111400
1212400
1313400
1414400
1515400
1616400
1717400
1818400
1919400
20200
21210
22220
23230
24240
25250
26260
27270
28280
29290
30300
31
Sheet1
Cell Formulas
RangeFormula
S1:S30S1=SEQUENCE(30)
T1:T30T1=LET(n,S1#,IF(DR*n<=Ded,DR*n,IF(DR*n>=OP,0,PC)))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Ded=Sheet1!$Y$2T1
DR=Sheet1!$Y$1T1
OP=Sheet1!$Y$3T1
PC=Sheet1!$Y$4T1
 
Upvote 0
This looks perfect, but can't seem to get it to work on my end. I'm good with the Sequence Range in S1. I Entered your formula in T1. When I plug in T1 gets a #SPILL and the others gets a #NAME. I think the issue is with the Named Ranges. Maybe not inputing them correctly? How are the named ranges supposed to be input on the sheets? I've never used the Let Fx so maybe that's why I'm having trouble. This great though, thank you....any tips on getting this to work would be appreciated.
Screenshot 2023-12-20 at 4.50.51 PM.png
 
Upvote 0
Have you defined the names?

1703110643663.png


If you don't want to use range names, try:

=LET(n,S1#,IF(Y1*n<=Y2,Y1*n,IF(Y1*n>=Y3,0,Y4)))
or
=LET(n,SEQUENCE(30),IF(Y1*n<=Y2,Y1*n,IF(Y1*n>=Y3,0,Y4)))

The formula should be entered only in T1. I suspect you've copied down to T2:T30, which is why the #SPILL! error in T1.
 
Upvote 0
Solution
Does Stephen Crump's post # 6 give you the answer?

What result are you looking for?

 
Upvote 0
Ok! This worked. The only problem now is that if Y1*1 or Y1*2, etc, is less than Y2, it needs to only show Y1. It seems like it's adding the amounts of Y1 together until it gets passed the amount in Y2. Everything else is working beautifully.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,114
Members
452,302
Latest member
TaMere

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