Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
Function as follows:
Function ReverseText(myText) ReverseText = StrReverse(myText) End Function Purpose: to change cell value 35 into cell value 53 this is not a problem. However, I do not want to exceed 70 in this mirror image. i.e. 19 becomes 91 which higher than 70 in cell C2 Using: =If (C270,," ") doesn't work for me, it is not text but a value, if I add =C2+1 which is 91 + 1 it equals 92 What am I missing? Which Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
Solution, as I pushed the enter button,
=IF(C270,C2,1) With Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
On Sep 25, 8:19*pm, smandula wrote:
Solution, as I pushed the enter button, =IF(C270,C2,1) With Thanks It still doesn't work! I need C2 to register as a value. If C2 is greater than 70 to register as a blank =IF(C2<70,C2," " Cell A1 has the variable ie 35 Cell C2has a formula =ReverseText(A1) Cell D3 has the above formula =IF(C2<70,C2," ") Any opinions, |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
=IF(--C2<70,--C2," ")
Regards, Bernd |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
"smandula" wrote:
Cell A1 has the variable ie 35 Cell C2has a formula =ReverseText(A1) Cell D3 has the above formula =IF(C2<70,C2," ") At a minimum, try: =if(--C2<70, C2, "") Note: I use "", not " ". The latter will cause huge problems for you later. The problem you are having is: your ReverseText returns text, not a number. In a comparison, text is always considered greater than any number. The form --C2 ensures that the text (presumed to be numeric string) is converted to a number for the comparison. Any opinions Many. First, why not have this handled in the UDF? Second, do you really what the UDF to return a number (as long as it meets the criteria), not text? Third, why use a UDF in the first place? If you want to handle this in the UDF, you would write: Function rt(txt) x = StrReverse(txt) If IsNumeric(x) And x < 70 Then rt = x Else rt = "" End Function If you want the UDF to return a number instead of text, then write: Function rt(txt) x = StrReverse(txt) If IsNumeric(x) And x < 70 Then rt = --x Else rt = "" End Function ----- original message ----- "smandula" wrote in message ... On Sep 25, 8:19 pm, smandula wrote: Solution, as I pushed the enter button, =IF(C270,C2,1) With Thanks It still doesn't work! I need C2 to register as a value. If C2 is greater than 70 to register as a blank =IF(C2<70,C2," " Cell A1 has the variable ie 35 Cell C2has a formula =ReverseText(A1) Cell D3 has the above formula =IF(C2<70,C2," ") Any opinions, |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
If logical statement and a function
On Sep 26, 11:35*am, Bernd P wrote:
=IF(--C2<70,--C2," ") Regards, Bernd Thanks It works wonderful |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If Statement with Two Different Logical Test | Excel Worksheet Functions | |||
Logical statement: equivalent of an IN function? | Excel Programming | |||
Explaination of Logical If Then Statement | Excel Worksheet Functions | |||
Logical statement for 'contains' ? | Excel Discussion (Misc queries) | |||
Logical Statement | Excel Discussion (Misc queries) |