Return a value if..

ajaay

New Member
Joined
Feb 14, 2011
Messages
21
Hi.

I have a sheet that i need to set up so that if a value is less then 5000 it will return a number 4 and then if it is greater then 5000 it willl return the number 6. How does one do that? Thanks i have tried and failed and producing such a thing any help with this easy task would be great!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello,
Welcome!

What if it is 5000 even?

This handles for that, you might need to tweak it a bit:

<TABLE style="WIDTH: 96pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=128><COLGROUP><COL style="WIDTH: 96pt" width=128><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: #eaf1dd; WIDTH: 96pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20 width=128>=IF(A1<=5000,4,6)</TD></TR></TBODY></TABLE>
 
Upvote 0
=IF(A2 < 5000,4,IF(A2 > 5000,6,""))

This leaves the cell blank if the value in A1=5000. If you want something else then replace the "" with the proper value.
 
Upvote 0
This will, is that what you would like?

<TABLE style="WIDTH: 153pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=204><COLGROUP><COL style="WIDTH: 153pt; mso-width-source: userset; mso-width-alt: 3730" width=204><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: white; WIDTH: 153pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20 width=204>=IF(A1="",0,IF(A1<=5000,4,6))</TD></TR></TBODY></TABLE>
 
Upvote 0
What about if the cell doesn't have a value in it? will it return it as 0?
If there is a number in the cell will it always be a positive number?

if a value is less then 5000 it will return a number 4 and then if it is greater then 5000 it willl return the number 6.
OK, what if the number IS 5000?

Instead of guessing at what you want I'd rather ask for clarification before I suggest something.
 
Upvote 0
If there is a number in the cell will it always be a positive number? Yes it will


OK, what if the number IS 5000? return 6

Instead of guessing at what you want I'd rather ask for clarification before I suggest something.
does that help? sorry i may not have put enough information in my opening question
 
Upvote 0
If the cell is blank then it would have a value of 0 which is less than 5000 so it would return 4. If you need to check for blank cells, that would require another modification.

=IF(A1<>"",IF(A1<5000,4,IF(A1>5000,6,"")),"0")

This returns 0 if the cell is blank, and a blank cell if the cell equals 5000.
 
Last edited:
Upvote 0
Try this:

<TABLE style="WIDTH: 153pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=204><COLGROUP><COL style="WIDTH: 153pt; mso-width-source: userset; mso-width-alt: 3730" width=204><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: white; WIDTH: 153pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20 width=204>=IF(A1="",0,IF(A1<5000,4,6))</TD></TR></TBODY></TABLE>
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,758
Members
452,940
Latest member
rootytrip

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