Choose Function not returning expected results!

GeorgieAnne

New Member
Joined
Feb 20, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello My first post here, and I am hoping someone can help me!

I am using the following CHOOSE Function:

=CHOOSE(($D$2<=2)+($D$2=3)+($D$2=4)+($D$2=5)+($D$2>5),5,4,3,1,0)

If cell D2 has a 1 or a 2, I need the CHOOSE function to return 5.

If cell D2 has a 3, I need the CHOOSE function to return 4.

If cell D2 has a 4, I need the CHOOSE function to return 3.

If cell D2 has a 5, I need the CHOOSE function to return 1.

If cell D2 has a value > 5, I need the CHOOSE function to return 0.

Cell D2 will have positive integers between 1 and x. There is no zero values and x is typically less that 10, but it could jump and be as large as 2000.


But the above formula in cell H2 always return 5, and I am not sure why? Even if I change the value of D2 it is always returning 5?

If anyone can help me out I would appreciate it a lot.

I am using Windows 10 64-bit and Office 365 and my Excel version is 2201 Build 16.0.14827.20198

Thanks a Million!

Georgie
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi & welcome to MrExcel.
You always get 5 as no matter what the value of D2 is this part ($D$2<=2)+($D$2=3)+($D$2=4)+($D$2=5)+($D$2>5) will always return 1
How about like
Excel Formula:
=($D$2<=2)*5+($D$2=3)*4+($D$2=4)*3+($D$2=5)*1+($D$2>5)*0
 
Upvote 0
Hi,

A couple more suggestions:

Note: F2 formula would be how the CHOOSE function works in your case.

Book3.xlsx
DEF
2155
Sheet1010
Cell Formulas
RangeFormula
E2E2=LOOKUP(D2,{1,3,4,5,6},{5,4,3,1,0})
F2F2=IF(D2>5,0,CHOOSE(D2,5,5,4,3,1))
 
Last edited:
Upvote 0
Another option
Excel Formula:
=SWITCH(D2,1,5,2,5,3,4,4,3,5,1,0)
 
Upvote 0
Thank You Fluff, I guess I was following the syntax too much! Your first example worked wonderfully and its initiative enough to relate to the data.

Many Thanks!
Another option
Excel Formula:
=SWITCH(D2,1,5,2,5,3,4,4,3,5,1,0)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Hi,

A couple more suggestions:

Note: F2 formula would be how the CHOOSE function works in your case.

Book3.xlsx
DEF
2155
Sheet1010
Cell Formulas
RangeFormula
E2E2=LOOKUP(D2,{1,3,4,5,6},{5,4,3,1,0})
F2F2=IF(D2>5,0,CHOOSE(D2,5,5,4,3,1))
Thanks jtakw for the fast response!

Greatly appreciated.
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,175
Members
449,071
Latest member
cdnMech

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