Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default multiply text and number

Hi there, I'm writing a UDF and trying to multiply text and number. (Answer
will show in text)

Function Pallet(MyNum)
Dim i As Integer
i = MyNum Mod 20
Dim j As Integer
j = Fix(MyNum / 20)

if i = 9 and i <= 12 then "L" should appear (j-1) times
Let's say MyNum = 72
So, i = MyNum Mod 20 = 12
And j = Fix(MyNum / 20) = 3

I want the answer shows letter "L" appear (j-1) times, which is 2 times
like this : LL [in text format]

Is it possible?

Since outside this UDF, I count the total occurences of letter "L" in a
range. Therefore, i prefer answer in here shows "LL" instead of "2 L"

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default multiply text and number

Function Pallet(MyNum) As String
Pallet = String(Int(MyNum / 20) - 1, "L")
End Function

"Lucy" wrote:

Hi there, I'm writing a UDF and trying to multiply text and number. (Answer
will show in text)

Function Pallet(MyNum)
Dim i As Integer
i = MyNum Mod 20
Dim j As Integer
j = Fix(MyNum / 20)

if i = 9 and i <= 12 then "L" should appear (j-1) times
Let's say MyNum = 72
So, i = MyNum Mod 20 = 12
And j = Fix(MyNum / 20) = 3

I want the answer shows letter "L" appear (j-1) times, which is 2 times
like this : LL [in text format]

Is it possible?

Since outside this UDF, I count the total occurences of letter "L" in a
range. Therefore, i prefer answer in here shows "LL" instead of "2 L"

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default multiply text and number

Thanks Joel, it works perfect!

"Joel" wrote:

Function Pallet(MyNum) As String
Pallet = String(Int(MyNum / 20) - 1, "L")
End Function

"Lucy" wrote:

Hi there, I'm writing a UDF and trying to multiply text and number. (Answer
will show in text)

Function Pallet(MyNum)
Dim i As Integer
i = MyNum Mod 20
Dim j As Integer
j = Fix(MyNum / 20)

if i = 9 and i <= 12 then "L" should appear (j-1) times
Let's say MyNum = 72
So, i = MyNum Mod 20 = 12
And j = Fix(MyNum / 20) = 3

I want the answer shows letter "L" appear (j-1) times, which is 2 times
like this : LL [in text format]

Is it possible?

Since outside this UDF, I count the total occurences of letter "L" in a
range. Therefore, i prefer answer in here shows "LL" instead of "2 L"

Thank you.

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
How to multiply a number by a set of numbers Dream Excel Discussion (Misc queries) 3 September 8th 09 02:47 PM
HOW DO I MULTIPLY BY A VALUE NOT MORE THAN A CERTAIN NUMBER Mnas Excel Discussion (Misc queries) 7 March 10th 08 12:59 AM
Automatically multiply be a number. lee lee Excel Worksheet Functions 1 April 7th 06 04:24 AM
multiply a row by a certain number? multiply a row by a certain number? Excel Discussion (Misc queries) 2 March 7th 05 09:18 PM
how can i multiply a number in each cell? jay Excel Discussion (Misc queries) 3 February 3rd 05 04:52 PM


All times are GMT +1. The time now is 10:32 AM.

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"