Solved

IF OR formula Excel

Posted on 2016-10-12
8
51 Views
Last Modified: 2016-10-12
can any one help me with one formula which will solve the following if statement?

IF A1 is >0<=10 then return 1

OR

IF A1 is >10<=20 then return 2

OR

IF A1 is >20<=30 then return 3

OR

IF A1 is >30 then return 4
0
Comment
Question by:mikes6058
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 26

Accepted Solution

by:
ProfessorJimJam earned 250 total points
ID: 41840272
=IF(AND(A1>0,A1<=10),1,IF(AND(A1>10,A1<=20),2,IF(AND(A1>20,A1<=30),3,IF(A1>30,4,0))))
0
 
LVL 50

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 125 total points
ID: 41840274
Hi,

pls try

=5-MATCH(A1,{10000;30;20;10;0},-1)

Open in new window

Regards
0
 

Author Comment

by:mikes6058
ID: 41840312
Great, how would this work in DAX formula

assuming A1 is a column reference?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 33

Expert Comment

by:Rob Henson
ID: 41840361
Alternative but don't know about converting to DAX.

=MAX(1,MIN(4,CEILING(A1,10)/10))

CEILING(Number,Factor)  rounds up a number to the next unit of factor, 10 in this instance.

Dividing by 10 then gives a single integer. Using MIN to compare with 4 ensures it doesn't go higher than 4; using MAX to compare with 1 ensures it doesn't go below 1, otherwise a zero value would give zero result.
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41840373
Mike,

i did not see anything about DAX in your original post.

you can use the same way as i described with DAX as well, except that the cell reference will not be A1 and it will be the column structured reference inside brakets

https://msdn.microsoft.com/en-us/library/ee634824.aspx
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 125 total points
ID: 41840387
Looking at that link from ProfJJ, it would seem that my suggestion would become:

=MAX(1,MIN(4,CEILING([ColumnHeader],10)/10))   where ColumnHeader refers to header of column to be considered.

Thanks
Rob H
0
 

Author Comment

by:mikes6058
ID: 41840421
Great, all good solutions.

Hadn't seen the Rob or Rgonzo's techniques before :)

Mike
0
 

Author Comment

by:mikes6058
ID: 41840423
nice work
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
adding "ungroup sheets" to existing vbs code 5 31
Copy and Paste Text into Text Box 3 29
Excel 2007 VB Code for GCF 7 16
Countdown Timer Advanced 5 20
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question