Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Find a . (period)

I have a variable called "TmpVal" and it can be anything.
It will always have a "." in the value. How do I make it
show the value up to the very first "." going from left to
right?

Thank you
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find a . (period)

For x = Len(TmpVal) To 1 Step -1
If Mid(TmpVal, x, 1) = "." Then
prd = x
End If
Next x
Cells(1, 1).Value = Left(TmpVal, prd - 1)

- Piku

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find a . (period)

Or...

Do
prd = prd + 1
Loop Until Mid(TmpVal, prd, 1) = "."
Cells(1, 1).Value = Left(TmpVal, prd - 1)

That's more compact... - Piku

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find a . (period)

Cells(1, 1).Value = Left(TmpVal, InStr(TmpVal, ".") - 1)

even better. I'm sad I didn't think about that one. :-(
I just insist on going about things the long way... - Piku

--
Message posted from http://www.ExcelForum.com



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find a . (period)

since you said left to right, better yet to try using instrrev


Why?

Left to right would be the normal way, so instr should be just fine.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
since you said left to right, better yet to try using instrrev

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
Have a look in vba help index for instr

--
Don Guillett
SalesAid Software

"Todd Huttenstine" wrote in

message
...
I have a variable called "TmpVal" and it can be anything.
It will always have a "." in the value. How do I make it
show the value up to the very first "." going from left to
right?

Thank you
Todd Huttenstine







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find first period from the right David P. Excel Discussion (Misc queries) 2 December 11th 08 03:09 AM
Find Period Date? MrRJ Excel Discussion (Misc queries) 5 November 25th 08 03:48 PM
pay back period Kake Excel Discussion (Misc queries) 1 May 20th 07 03:34 AM
3 lates in any 35 day period. paulrm906 Excel Discussion (Misc queries) 3 June 27th 06 06:40 AM
Period to Period percentage change? cs120 Excel Discussion (Misc queries) 1 September 18th 05 12:05 PM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"