Embedded If statements

Rockerdo

Board Regular
Joined
Aug 15, 2016
Messages
73
I need help putting in ranges for my embedded IF's in a formula

If $A7 is = to 1-7 (meaning 1,2,3,4,5,6,7) return value 0, if $A7 is = 8-22 return value of 1, IF $A7 is 23-37 return value of 2, if $A7 is 38-52 return value of 3

Thank you
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
What should be returned when a7 is less then 0 or greater then 52? The below formula returns blank.

Code:
=IF(AND(A7>=1,A7<=7),0,IF(AND(A7>=8,A7<=22),1,IF(AND(A7>=23,A7<=37),2,IF(AND(A7>=38,A7<=52),3,""))))
 
Upvote 0
Not sure if you can use, but for teaching purposes it's best to set up a Lookup Value Table (My Column A-C) and refer
to it elsewhere in your Entry section... Just saying... FWIW... Copy G3 down to G6

Excel 2010
ABCDEFG
1** Controlling Table of Values **YourValue from
2MinMaxValueEntry AmtTable
317081
48221221
523372302
638523483

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
G3=LOOKUP(F3,$A$3:$C$6)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Yes thank you. If A7 is blank or 0 it will be ""
It will be rare it is over 52. I can expand the formula further to include up to the 7 IF's.

VLookup is my preferred but there are reasons we need another option.

Thank you
 
Upvote 0
Hi,

If you don't want to build a Table, instead of Nesting a bunch of IF statements, you can do this:


Book1
ABC
720
870
9
1081
11221
12242
13372
14393
15523
1655
17383
Sheet7
Cell Formulas
RangeFormula
C7=LOOKUP(A7,{0,1,8,23,38,53},{"",0,1,2,3,""})
 
Upvote 0

Forum statistics

Threads
1,215,757
Messages
6,126,693
Members
449,331
Latest member
smckenzie2016

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