Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Extract a percentage from a text

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Extract a percentage from a text

The number is always the last thing in the string and it always has a space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Extract a percentage from a text

Thanks a lot!
"Dave Peterson" wrote in message
...
The number is always the last thing in the string and it always has a
space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Extract a percentage from a text

Dear Dave:
Could you please tell me what is the problem of this function?

Function efind(Find_value, Within_Text)
E = WorksheetFunction.Find(Find_value, Within_Text)
efind = WorksheetFunction.Mid(Within_Text, E - 1, 2)
End Function

"Lok Tak Cheong" wrote in message
...
Thanks a lot!
"Dave Peterson" wrote in message
...
The number is always the last thing in the string and it always has a
space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong


--

Dave Peterson





  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Extract a percentage from a text

Assuming the value is actually in the text being searched (also Find is case
sensitive), probably because VBA has it's own Mid function - so drop the
worksheetfunction.mid and change to just mid.

Function efind(Find_value, Within_Text)
E = WorksheetFunction.Find(Find_value, Within_Text)
efind = Mid(Within_Text, E - 1, 2)
End Function


"Lok Tak Cheong" wrote:

Dear Dave:
Could you please tell me what is the problem of this function?

Function efind(Find_value, Within_Text)
E = WorksheetFunction.Find(Find_value, Within_Text)
efind = WorksheetFunction.Mid(Within_Text, E - 1, 2)
End Function

"Lok Tak Cheong" wrote in message
...
Thanks a lot!
"Dave Peterson" wrote in message
...
The number is always the last thing in the string and it always has a
space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong

--

Dave Peterson








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Extract a percentage from a text

And look at VBA's help for instr. It'll do the equivalent of the worksheet
function Find.

Lok Tak Cheong wrote:

Dear Dave:
Could you please tell me what is the problem of this function?

Function efind(Find_value, Within_Text)
E = WorksheetFunction.Find(Find_value, Within_Text)
efind = WorksheetFunction.Mid(Within_Text, E - 1, 2)
End Function

"Lok Tak Cheong" wrote in message
...
Thanks a lot!
"Dave Peterson" wrote in message
...
The number is always the last thing in the string and it always has a
space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong

--

Dave Peterson




--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Extract a percentage from a text

Dear JMB and Dave:
Thank you very much!!!

"Dave Peterson" wrote in message
...
And look at VBA's help for instr. It'll do the equivalent of the
worksheet
function Find.

Lok Tak Cheong wrote:

Dear Dave:
Could you please tell me what is the problem of this function?

Function efind(Find_value, Within_Text)
E = WorksheetFunction.Find(Find_value, Within_Text)
efind = WorksheetFunction.Mid(Within_Text, E - 1, 2)
End Function

"Lok Tak Cheong" wrote in message
...
Thanks a lot!
"Dave Peterson" wrote in message
...
The number is always the last thing in the string and it always has a
space
character before it?

If yes to both, then this returned 50 for me:

=1000*RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1," ","")))))



Lok Tak Cheong wrote:

A1 is text: The increment is 5%
B1 is value and formula = 1000 * (increment in A1)
Can anyone help with this?
Thanks in advance,
Cheong

--

Dave Peterson



--

Dave Peterson



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
Count Text to get a Percentage Craig Excel Worksheet Functions 5 April 22nd 23 09:04 PM
refer a cell text in b1 and extract remaing text from a1 Narnimar Excel Discussion (Misc queries) 4 April 3rd 10 12:30 PM
How to extract text from number/text cell Access Joe Excel Worksheet Functions 6 December 1st 09 08:35 PM
Extract data that has increased by a percentage swfisher Excel Discussion (Misc queries) 1 February 3rd 06 02:35 AM
Convert Percentage to Text Kinjalip Excel Discussion (Misc queries) 2 September 28th 05 01:53 PM


All times are GMT +1. The time now is 11:10 PM.

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

About Us

"It's about Microsoft Excel"