Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
left()
Why the command b=Left(poz, InStr(poz, "!") + 1) is working and b=Left(poz, InStr(poz, "!") - 1) doesn't work? It say: Invalid procedure call or argument... -- mpele ------------------------------------------------------------------------ mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808 View this thread: http://www.excelforum.com/showthread...hreadid=520041 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
left()
Hi M,
If the exclamation character (!) is found, both expressions work for me. If however, the character is not found, then the exptrssion: InStr(poz, "!") - 1 equates to -1 which is an invalid in the Left function, --- Regards, Norman "mpele" wrote in message ... Why the command b=Left(poz, InStr(poz, "!") + 1) is working and b=Left(poz, InStr(poz, "!") - 1) doesn't work? It say: Invalid procedure call or argument... -- mpele ------------------------------------------------------------------------ mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808 View this thread: http://www.excelforum.com/showthread...hreadid=520041 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
left()
If it doesn't find ! in the string poz, then the Instr returns 0. Subtract 1
from that, and you are then trying to get the leftmost -1 characters. Hence, it is invalid. You should test it if InStr(poz, "!") 0 Then b=Left(poz, InStr(poz, "!") - 1) Else b = poz End If -- HTH Bob Phillips (remove nothere from email address if mailing direct) "mpele" wrote in message ... Why the command b=Left(poz, InStr(poz, "!") + 1) is working and b=Left(poz, InStr(poz, "!") - 1) doesn't work? It say: Invalid procedure call or argument... -- mpele ------------------------------------------------------------------------ mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808 View this thread: http://www.excelforum.com/showthread...hreadid=520041 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
left()
Norman Jones Wrote: Hi M, If the exclamation character (!) is found, both expressions work for me. InStr gives result 6 but I need value 5 for function left. What am I doing wrong? or what can I do wrong?!? -- mpele ------------------------------------------------------------------------ mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808 View this thread: http://www.excelforum.com/showthread...hreadid=520041 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
left()
Hi M,
Your error is consistent with the exclamation character not being found. If the expression: InStr(poz, "!") returns 6, as you suggest, I would not expect either of your original expressions: b=Left(poz, InStr(poz, "!") + 1) or b=Left(poz, InStr(poz, "!") - 1) to produce your encountered error. --- Regards, Norman "mpele" wrote in message ... Norman Jones Wrote: Hi M, If the exclamation character (!) is found, both expressions work for me. InStr gives result 6 but I need value 5 for function left. What am I doing wrong? or what can I do wrong?!? -- mpele ------------------------------------------------------------------------ mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808 View this thread: http://www.excelforum.com/showthread...hreadid=520041 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
LEFT function-all to left of a comma? | Excel Worksheet Functions | |||
when inserting new worksheets they read right to left not left to. | Setting up and Configuration of Excel | |||
My Excel view is Right to Left instead of Left to Right !!! | Excel Discussion (Misc queries) | |||
Column labels run right to left, not left to right | Excel Discussion (Misc queries) | |||
How to change the right-to-left worksheet to left-to-right workshe | Excel Discussion (Misc queries) |