Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to multiply a number by a set of numbers | Excel Discussion (Misc queries) | |||
HOW DO I MULTIPLY BY A VALUE NOT MORE THAN A CERTAIN NUMBER | Excel Discussion (Misc queries) | |||
Automatically multiply be a number. | Excel Worksheet Functions | |||
multiply a row by a certain number? | Excel Discussion (Misc queries) | |||
how can i multiply a number in each cell? | Excel Discussion (Misc queries) |