Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, I need help!
I am trying to do a price list for my representatives where we have our retail prices and also I would like to have a price code for my bottom line price. The code should have the words MAKEPROFIT as the key for 1234567890 therefore a price $11.33 should display MM.KK or $44.77 should display EE.OO could anybody help with this issue? Thank you, Claudio |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Quick and dirty with minimal testing:-
Const code As String = "MAKEPROFIT" Sub TestConvertToCode() 'Converts number to code With ActiveCell .Value = ConvertToCode(.Value) End With End Sub Sub TestConvertToNum() 'Converts code back to number With ActiveCell .Value = ConvertToNum(.Value) End With End Sub Function ConvertToCode(Val As Single) As String Dim i As Integer Dim t As String, tt As String, v As String v = Format(Val, "#.00") For i = 1 To Len(v) t = Mid(v, i, 1) Select Case t Case 0 tt = tt & "T" Case "." tt = tt & t Case Else tt = tt & Mid(code, CInt(t), 1) End Select Next ConvertToCode = tt End Function Function ConvertToNum(txt As String) As String Dim i As Integer, n As Integer Dim t As String, tt As String For i = 1 To Len(txt) t = Mid(txt, i, 1) Select Case t Case "T" n = 0 tt = tt & n Case "." tt = tt & t Case Else n = InStr(code, t) tt = tt & n End Select Next ConvertToNum = Format(tt, "#.00") End Function Regards, Greg " wrote: Hello, I need help! I am trying to do a price list for my representatives where we have our retail prices and also I would like to have a price code for my bottom line price. The code should have the words MAKEPROFIT as the key for 1234567890 therefore a price $11.33 should display MM.KK or $44.77 should display EE.OO could anybody help with this issue? Thank you, Claudio |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sales history and how Unit Price affects it... | Charts and Charting in Excel | |||
analysing sales vs price | Excel Worksheet Functions | |||
How do I calculate profit as a % of Sales price | Excel Discussion (Misc queries) | |||
base price list compute on to another price list? on excel work sh | Excel Discussion (Misc queries) | |||
Computing Sales Tax and Retail Price from a number | Excel Worksheet Functions |