ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Price List For Sales Representative (https://www.excelbanter.com/excel-programming/376768-price-list-sales-representative.html)

[email protected]

Price List For Sales Representative
 
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


Greg Wilson

Price List For Sales Representative
 
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




All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com