If And Formula issue

millsey

New Member
Joined
Jul 6, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
To the expert who can decipher this, i am trying to solve an issue on my excel spreadsheet. I will write the formula of which i am trying to achieve and hopefully someone can see where i am going wrong and how i can best fix this.

=if(And(B2<=D1),"1","If"(B2>D1,B2<=D2),"2","if"(B2>D2,<=D3),"3","If"(B2>D3,B2<=D4),"4","")))) and so on if necessary

this formula is to be written in cell F1

Value examples in D1 - 3, D2 - 6, D3 - 9, D4 - 12

Value to be entered in B2 will be between this figures .... say 7
which i hoped would automatically select the number 3 in cell F1 as a result but i keep getting a formula error in the way i am trying to express the formula and my problem.

I someone is smart enough to figure this one out or solve a better way or getting my end result i would be extremely grateful
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Book1
BCDEF
133
296
39
412
Sheet1
Cell Formulas
RangeFormula
F1F1=IF(B2<=D1,"1",IF(AND(B2>D1,B2<=D2),"2",IF(AND(B2>D2,B2<=D3),"3",IF(AND(B2>D3,B2<=D4),"4"))))
 
Upvote 0
Another option
Excel Formula:
=IF(B2<=D1,1,IF(B2<=D2,2,IF(B2<=D3,3,IF(B2<=D4,4,""))))
 
Upvote 0

Forum statistics

Threads
1,215,381
Messages
6,124,614
Members
449,175
Latest member
Anniewonder

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