![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,038
|
I would like cell B1 to return the value in cell A1 if that value is either 1 or greater (the number of coffins sold to customers) or if it is minus 1 or less (the number of coffins returned by dissatisfied customers). If the value is between those two, i.e. .5, 0 or NO ENTRY AT ALL, I would like B1 to return "Incorrect Input, Fool!"
The Lotus formula was: @IF(A1>1#AND#A1<-1,"Incorrect Input, Fool",A1) The AND function in Excel seems to only return TRUE or FALSE. |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
|
You need a nested IF for that...
=IF(A1>=1,A1,IF(A1<=-1,A1,"Incorrect input fool!")) Rgds AJ |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,038
|
Well, duh! Now I really feel stupid. Thanks for the fast response, AJ.
|
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
or, better: =IF(ABS(A1)>=1,A1,"Incorrect Input, Fool") or, even better: =IF((ABS(A1)>=1)*(A1-INT(A1)=0),A1,"Incorrect Input, Fool") |
|
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 18
|
why not use the AND function (also works on OR)
=if(or(a1>1,a1<-1),"vaild input","wrong input") |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,038
|
Thanks, people. They all work. Now, how do I choose?
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|