Nesting Various Ranges Within an IF(COUNTIF( formula

breakr19

New Member
Joined
Aug 5, 2011
Messages
6
I'm trying to come up with a formula that will return "4" if the value of Q50 can be found in a certain range.

What that range is, however, will vary depending on only one condition.

So, I have the following:

=IF(COUNTIF("RANGE",Q50),4,0) where I want the "RANGE" to be: N2:N33 if B69=1, N34:N49 if B69=2, N50:N57 if B69=3, N58:N61 if B69=4, and N62:N63 if B69=5.

Is it possible to swap in different ranges in this way? Any help would be appreciate, and happy to answer any clarifying questions. Thanks in advance!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
named each of your range and then try:Sheet1

*BCGHIMNOPQ
*********
*********
********
*********
*********
*********
*********
*********
*********
*********
*********
*********
*********
*********
*********
*********A
**********
*********
**********

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:2px;"><col style="width:64px;"><col style="width:64px;"><col style="width:20px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

[TD="align: right"]4[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]17[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]18[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]19[/TD]

[TD="bgcolor: #ffff00"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]40[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]43[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]44[/TD]

[TD="bgcolor: #ccccff"]A[/TD]

[TD="bgcolor: #cacaca, align: center"]45[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]46[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]47[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]48[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]49[/TD]

[TD="bgcolor: #ccccff"]*[/TD]

[TD="bgcolor: #cacaca, align: center"]50[/TD]

[TD="bgcolor: #cacaca, align: center"]51[/TD]

[TD="bgcolor: #cacaca, align: center"]69[/TD]
[TD="bgcolor: #33cccc, align: right"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]70[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
H5=IF(COUNTIF(CHOOSE(B69,first,second),Q50),4,0)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Have never used the CHOOSE feature before, that is exactly what I was looking for, thank you so much!
 
Upvote 0

Forum statistics

Threads
1,222,180
Messages
6,164,420
Members
451,894
Latest member
480BOY

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