There has to be a Simpler formula?

m_in_spain

Board Regular
Joined
Sep 28, 2018
Messages
72
Office Version
  1. 365
Platform
  1. Windows
Hi (again)
I am sure this is something to do with array or range, but i cannot get my head around it.

There must be a simpler way to express the "if(or(" part of the following formula (in red).

=IF(qcountry=CA1,1,IF(OR(qcountry=CA2,qcountry=CA60,qcountry=CA81),3,IF(OR(qcountry=CA5,qcountry=CA6,qcountry=CA7,qcountry=CA8,qcountry=CA9,qcountry=CA10,qcountry=CA11,qcountry=CA12,qcountry=CA13,qcountry=CA14,qcountry=CA15,qcountry=CA16,qcountry=CA17,qcountry=CA18,qcountry=CA19,qcountry=CA20,qcountry=CA21,qcountry=CA22,qcountry=CA23,qcountry=CA24,qcountry=CA25,qcountry=CA26,qcountry=CA27,qcountry=CA28,qcountry=CA29,qcountry=CA30,qcountry=CA31,qcountry=CA32,qcountry=CA33,qcountry=CA34,qcountry=CA35,qcountry=CA36,qcountry=CA37,qcountry=CA38,qcountry=CA39,qcountry=CA40,qcountry=CA41,qcountry=CA42,qcountry=CA43,qcountry=CA44,qcountry=CA45,qcountry=CA46,qcountry=CA47),2,4)))

it is just a consecutive list from CA5 to CA47 This works but it is cumbersome

any help will be much appreciated,
TIA
 

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.
Hi,

I don't know what qcountry refers to, but see if this works for you:


Book1
J
2#NAME?
Sheet354
Cell Formulas
RangeFormula
J2=IF(qcountry=CA1,1,IF(OR(qcountry=CA2,qcountry=CA60,qcountry=CA81),3,IF(COUNTIF(CA5:CA47,qcountry),2,4)))
 
Upvote 0
Many thanks, yes that's exactly what i have been trying to do all day!!
qcountry is a list of countries that i have in my quote (q) - i have to keep this simple to get my head around it.
Again, many thanks for your answer
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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