The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Sell, Cost, Margin for HP41
Message #1 Posted by Alberto Fenini on 29 Oct 2012, 7:33 a.m.

ciao a tutti,
I would like to use my HP41C in my everyday work.
One of the things that I have to do more frequently is to evaluate the margin of a sale (yes, I'm a sales guy, sorry for that ...)
I need a program that given any two of these three values :
COST PRICE
SELL PRICE
MARGIN
will return the third value.
Does anyone know where can I find something like this ?
As always, thanks for help, Alberto

      
Re: Sell, Cost, Margin for HP41
Message #2 Posted by Bruce Larrabee on 29 Oct 2012, 9:04 a.m.,
in response to message #1 by Alberto Fenini

I can't make any promises at the moment. But if I can find time I will write the code for this for you.

By the way. I love the HP41C. But I use my HP27S the most when on the job. If you are curious, such a program can be written on it in easily under three minutes.

When I was given my first HP27S by a friend who was an engineer at HP it had not been put on the market yet.

The first program I wrote for it (he laughed when I requested a manual for it, 'you won't need one', at the time this was a preposterous assertion. Or so I thought.) The first program I wrote for it (with no information on the calculators operations of any kind) was: BIG+BIGGER=BIGGEST

This is essentially exactly the same thing you need, ie: SELLPRICE-COST=MARGIN

When this program is entered on the 27S it automatically generates a menu at the bottom of the display with the top row of keys being connected to the menu.

And critical to a app such as you need the formula can always be used in any order nonlinearity.

You may well already be quite familiar with all of that. At the time I was somewhat amazed.

      
Re: Sell, Cost, Margin for HP41
Message #3 Posted by C.Ret on 29 Oct 2012, 10:33 a.m.,
in response to message #1 by Alberto Fenini

Quote:
ciao a tutti,

Bonjour à tous,
Quote:
I would like to use my HP41C in my everyday work.
That’s a good new,still using a HP-41C today is at you honour.
Quote:
One of the things that I have to do more frequently is to evaluate the margin of a sale
I need a program that given any two of these three values :
COST PRICE
SELL PRICE
MARGIN
will return the third value.

Does anyone know where can I find something like this ?
I have no idea, but as a professional buyer-man for the account of a national institution, I already write a program for buy pricing, cost and estimation of lost. This is a short version of it:
--------------------------------------------------------------
01 LBL "A       09 LBL "B      17 LBL "C       23 LBL 09
02   RCL 00     10   STO 01    18   STO 00     24   "~:
03   +                         19 GTO "a       25   ARCL X
04   STO 01     11 LBL "a                      26   AVIEW
                12   RCL 01                    27 END
05 LBL "b       13   RCL 00      
06   RCL 01     14   -         20 LBL "c
07   "PRICE     15   "MARGIN   21   RCL 00
08 GTO 09       16 GTO 09      22   "COST
--------------------------------------------------------------
Usage :

In USER mode, enter a value and press the following:
[ A ] key : to set margin. A new PRICE is computed and displayed. COST remain constant.
[shift]+[ A ] : to display MARGIN.

[ B ] key : to set SELL PRICE. A new MARGIN is computed and displayed. COST remain constant.
Note that mnemomic B was initially used as Buy Price.
[shift] + [ B ] : to display SELL/BUY PRICE.

[ C ] key: to set constant COST value. A new MARGIN is computed and displayed. PRICE remain constant.
[shift] + [ C ] : to display COSTs.

Note1: Only two registers are used: R00 = (constant cost ) and (R01 = sell/buy price).
Note2: Displayed results can be use in futher computation since the value is displayed (in alpha register) and a copy left in x register.

Edited: 29 Oct 2012, 12:38 p.m.

      
Re: Sell, Cost, Margin for HP41
Message #4 Posted by Mark Storkamp on 29 Oct 2012, 3:16 p.m.,
in response to message #1 by Alberto Fenini

This is based on some of the solution book problems such as TVM that use the display as a menu for the top row of keys.

 01 LBL "CSM" 
 02 LBL J 
 03 SF 27 
 04 CF 22 
 05 "CP SP M" 
 06 AVIEW 
 07 STOP 
 08 LBL A 
 09 STO 01 
 10 FS? 22 
 11 GTO J 
 12 RCL 02 
 13 RCL 03 
 14 - 
 15 STO 01 
 16 VIEW X 
 17 STOP 
 18 GTO J 
 19 LBL B 
 20 STO 02 
 21 FS? 22 
 22 GTO J 
 23 RCL 01 
 24 RCL 03 
 25 + 
 26 STO 02 
 27 VIEW X 
 28 STOP 
 29 GTO J 
 30 LBL C 
 31 STO 03 
 32 FS? 22 
 33 GTO J 
 34 RCL 02 
 35 RCL 01 
 36 - 
 37 STO 03 
 38 VIEW X 
 39 STOP 
 40 GTO J 
 41 END 
            
Re: Sell, Cost, Margin for HP41
Message #5 Posted by Alberto Fenini on 29 Oct 2012, 4:25 p.m.,
in response to message #4 by Mark Storkamp

Thank you very much to all of you.
Margin is actually given by this formula :
((selling price - purchase price)/selling price)*100
if selling price = 10 and purchase price = 9, margin is 10 per cent
I have been using my HP20S, but since I like vintage calculators I'm now using this Commodore.

I'd love to have a program that will allow me to use my HP41C, although I have a preference for red led (HPs).
Mark, C.Ret, are your programs working this way ?
Thanks again, Alberto

                  
Re: Sell, Cost, Margin for HP41
Message #6 Posted by C.Ret on 29 Oct 2012, 7:20 p.m.,
in response to message #5 by Alberto Fenini

Quote:
Margin is actually given by this formula :
((selling price - purchase price)/selling price)*100

01 LBL A   --- set margin% . Compute new Sell price
02 1
03 x:y
04 %
05 -
06 RCL 00
07 x:y
08 /
09 STO 01

10 LBL b --- diplay SELL PRICE 11 RCL 01 12 "PRICE 13 GTO 08

14 LBL B --- set SELL PRICE 15 STO 01

16 LBL a ---- Display margin % 17 RCL 01 18 RCl 00 19 %CH 20 CHS 21 "MARGE 22 FIX 1 23 SF 09 24 GTO 09

25 LBL C ---- set cost 26 STO 00 27 RCL 01 28 x>y? 29 GTO "a

30 LBL c ---- display cost 31 RCL 00 32 "COST

33 LBL 08 ==== display $ ####.## 34 "~: $ 35 FIX 2 36 LBL 09 ==== display ###.# % 37 ARCL X 38 FS?C 09 39 "~ % 40 AVIEW 41 END

Same usage as previous version. Enter margin as purcentage: 21.7 for 21.7%

In USER mode :

 CLRG
 20    [ C ] COST: $20.00
 75    [ A ] PRICE: $80.00
[shift][ a ] MARGIN 75.0 %

EDITed : wrong 10 into 20 (see later post from aurelio)

Edited: 1 Nov 2012, 1:36 p.m. after one or more responses were posted

                        
Re: Sell, Cost, Margin for HP41
Message #7 Posted by aurelio on 29 Oct 2012, 7:27 p.m.,
in response to message #6 by C.Ret

Thak-you, Ret

                        
Re: Sell, Cost, Margin for HP41
Message #8 Posted by Alberto Fenini on 31 Oct 2012, 8:26 a.m.,
in response to message #6 by C.Ret

Thank you very much !!
I'll load it on my HP41 and will let you know,
I assume it will work on HP65 or 67 as well, or am I saying something stupid ?
thanks again Alberto

                              
Re: Sell, Cost, Margin for HP41
Message #9 Posted by C.Ret on 31 Oct 2012, 1:53 p.m.,
in response to message #8 by Alberto Fenini

HI,

Nothing stupid, except you have to remove Alpha-numeric display. This can make the use of the program a bit confusing.

For nonb-alphanuméric system, I will preconise a simpler input/output philosophy :

       [ A ]  Input   Margin %   
[shift][ A ]  Display Margin %    ####.# 

[ B ] Input Buy/Sell price $ [shift][ B ] Display Buy/Sell price $ #####.##

[ C ] Input Cost $ [shift][ C ] Display Cost $ ####.####

001 *LBL A 21 11 017 *LBL B 21 12 002 1 01 018 STO1 35 01 003 x:y -41 019 *LBL b 21 16 12 004 % 55 020 RCL1 35 01 005 - -45 021 DSP2 -63 02 006 RCL0 36 00 022 R/S 51 007 x:y -41 008 / -24 023 *LBL C 21 13 009 STO1 35 01 024 STO0 35 00 010 *LBL a 21 16 11 025 *LBL c 21 16 13 011 RCL1 36 01 026 RCL0 35 00 012 RCL0 36 00 027 DSP4 -63 04 013 %CH 16 55 028 R/S 51 014 CHS -22 015 DSP1 -63 01 016 R/S 51

Edited: 31 Oct 2012, 2:24 p.m.

                        
Re: Sell, Cost, Margin for HP41
Message #10 Posted by Alberto Fenini on 31 Oct 2012, 5:27 p.m.,
in response to message #6 by C.Ret

Thanks Rec,
I know lot of people, and I mean LOT of people will laugh out loud but ...
where is the " character ??
by the way, one more silly question ...
when you say at line 03 and 07 x:y do you really mean I have to enter alpha mode and type x:y ?
can't find lower key x and lower key y, does it make a difference ?
I know collecting and restoring calculators does not make me automatically a programmer
please don't laugh too much ... :)))
take care Alberto

                              
Re: Sell, Cost, Margin for HP41
Message #11 Posted by C.Ret on 31 Oct 2012, 6:08 p.m.,
in response to message #10 by Alberto Fenini

Yes, sorry, I have bad typo habits!

In the HP41/42 listing the quote character ( " ) usually indicate ALPHA mode.

I also use the tilt ~ to indicate APPEND character (precede by a quote since it's an ALPHA mode function.

In the both listings, I used x:y as a personal representation of X exchange Y key ( X><Y in HP41/42 convention).

Again, apologize my specific use (and miss-use) of program code convention. And I am sure nobody will laugh here. We all strike trying to get readable code into in-line post. Not an easy task.

                                    
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #12 Posted by Alberto Fenini on 1 Nov 2012, 7:43 a.m.,
in response to message #11 by C.Ret

ciao Ret, ciao Everyone,
Ret, I have been able to load "all" the code into the machine :)
However, it behaves differently from what I would have expected, as it happens almost anytime humans beings relates with computers, calcs, spreadsheet etc etc ...
This is a picture of the two animals compared :

In sales, you usually know two factors and need to compute the third.
As an example, you know your buy price, customer sets your selling price (i.e. his buy price) and you are curious to know how rich you didn't get this time, i.e. you want to calculate your margin.
Or, you know that selling price, you want to get rich and set your margin, and you need to know what your buing price will be.
The Commodore F4902 works this way. You enter a digit and press the corresponding key,
say SEL for setting the Selling price and CST for setting you buying price.
Then, you press the F key (uppermost left key) and the MRG key, that will be calculated and shown.
On the HP41C, even if I perform the CLRG - I had to look in the manual to understand how to do it, and I spare you how tough has been to find the correct key sequence for the FS?C step :))) -
any time I enter a value, the program already compute a result.
Even if I look at you example, what do you mean with "10 [ C ] COST: $20.00" ?
If label C is setting the cost price, 10 [C] should'nt say COST 10 $ ??(BTW where the heck is the $ character, or any chance I can have the € ?)
I think you did a great job, but I still miss something, so if anyone still want to have some little fun in transforming a scientific calculator into a financial one :) please, help me understand what I'm doing wrong
Aurelio,did you get it working ?
Take care everyone, and thanks for the help and the fun !

                                          
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #13 Posted by aurelio on 1 Nov 2012, 8:03 a.m.,
in response to message #12 by Alberto Fenini

Hi Alberto, not yet, actually I couldn't take even the time to key the program and test.....hope I'll succed in the afternoon, stay tuned. Ciao.

                                          
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #14 Posted by aurelio on 1 Nov 2012, 12:26 p.m.,
in response to message #12 by Alberto Fenini

Quote:
On the HP41C, even if I perform the CLRG - I had to look in the manual to understand how to do it, and I spare you how tough has been to find the correct key sequence for the FS?C step :))) -
any time I enter a value, the program already compute a result.
Even if I look at you example, what do you mean with "10 [ C ] COST: $20.00" ?
If label C is setting the cost price, 10 [C] should'nt say COST 10 $ ??(BTW where the heck is the $ character, or any chance I can have the € ?)
I think you did a great job, but I still miss something, so if anyone still want to have some little fun in transforming a scientific calculator into a financial one :) please, help me understand what I'm doing wrong
Aurelio,did you get it working ?
Take care everyone, and thanks for the help and the fun !
Hi Alberto, hi Ret, hi all! I tried and all work great, but......only after a little review

@Ret: I found something wrong in the post...(just error in typing, sure):

In the example

CLRG

10 [ C ] COST: $20.00 >>>> should be 20 [ C ] COST: $20.00

75 [ A ] PRICE: $80.00

[shift][ a ] MARGIN 75.0 %

@all: here, below program listing with correct typo (program code convention)

MARGINE HP41-42 >>>>>>>>>>(MARGE)

01 LBL A

02 1

03 X<>Y

04 %

05 -

06 RCL 00

07 X<>Y

08 /

09 STO 01

10 LBL b

11 RCL 01

12 "PRICE"

13 GTO 08

14 LBL B

15 STO 01

16 LBL a

17 RCL 01

18 RCL 00

19 %

20 CHS

21 "MARGE"

22 FIX 1

23 SF 09

24 GTO 09

25 LBL C

26 STO 00

27 RCL 01

28 x>y?

29 GTO a

30 LBL c

31 RCL 00

32 "COST"

33 LBL 08

34 >" $"

35 FIX 2

36 LBL 09

37 ARCL X

38 FS? 09

39 >" %"

40 AVIEW

41 END

Thank-you a lot, Ret, for your program!!!

@Alberto: sure you found already how to get CLRG >> XEQ "CLRG", otherwise you can assign the command to a key in the "USER" mode

I got from the listing a raw file suitable for the emulator (thank-you a lot to Ulisse Quadri and Leo Duran!)

then I printed a code bar to avoid the keying on the real calculator. A lot of fun of course.......:))))

But now the challenge is to run programs on the not alphanumeric calculators!

Hope it helps, cheers Aurelio

Edited: 1 Nov 2012, 1:17 p.m.

                                                
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #15 Posted by C.Ret on 1 Nov 2012, 2:22 p.m.,
in response to message #14 by aurelio

Thank you aurelio for the careful review of my post and to correct the typo of my listing.
Beware that line is 019 %CH (% change instruction) and at line 038 FS?C 09 ( test if flag 9 is set and clear it).

====================================================================


To mimic the behavior of the Commodore Calculator, I produce a new version of the code were %Margin, $Sell/Buy Price and $ Cost are memorized.

Usage :
[ A ] Set new margin percentage.
[ shift ][ A ] Compute and display new margin percentage based on actual Price and COST.

[ B ] Set new Sell/Buy PRICE.
[shift][ B ] Compute and display PRICE based on actual %Margin and Cost.

[ C ] Set new Production/Providing Cost ($)
[shift][ C ] Compute and display COST based on actual %Margin and Price.

The CLRG, no more needed.

Sorry, but there no € caracter on the HP-41, no Euro nor Ecu exist at the time the Hewlett Packard Company produce the HP-41 Advanced Calculator ! Consequently there no € character in the set.

Registers:
R00: Cost in $ R01: Price in $ R02: Margin %

HP-41 version -----------------------------------------------------

01 LBL a 12 LBL b 23 LBL c 32 LBL 08 02 RCL 01 13 RCL 00 24 RCL 01 33 >" $" 03 RCL 00 14 1 25 ENTER^ 34 FIX 2 04 %CH 15 RCL 02 26 RCL 02 05 CHS 16 % 27 % 35 LBL 09 17 – 28 - 36 ARCL X 06 LBL A 18 / 37 FS?C 09 07 STO 02 29 LBL C 38 >" %" 08 "MARGE" 19 LBL B 30 STO 00 39 AVIEW 09 FIX 1 20 STO 01 31 "COST" 40 END 10 SF 09 21 "PRICE" 11 GTO 09 22 GTO 08

HP-97 version -----------------------------------------------------

001 *LBL a 21 16 11 011 *LBL b 21 16 12 023 *LBL c 21 16 13 032 *LBL 9 21 09 002 RCL1 36 01 012 RCL0 36 00 024 RCL1 36 01 033 DSP2 -61 02 003 RCL0 36 00 013 1 01 025 RCL2 36 02 034 RCL1 36 01 004 %CH 16 55 014 RCL2 36 02 026 % 55 035 PRTX -14 005 CHS -22 015 % 55 027 - -45 036 RCL0 36 00 016 - -45 037 PRTX -14 006 *LBL A 21 11 017 ÷ -24 028 *LBL C 21 13 038 DSP1 -61 01 007 STO2 35 02 029 STO0 35 00 039 RCL2 36 02 008 DSP1 -63 01 018 *LBL B 21 12 030 DSP2 -63 02 040 PRTX -14 009 R/S 51 019 STO1 35 01 031 R/S 51 041 DSP4 -61 04 010 GTO9 22 09 020 DSP2 -63 02 042 SPC 16-11 021 R/S 51 043 R/S 51 022 GTO9 22 09

Edited: 2 Nov 2012, 6:22 a.m. after one or more responses were posted

                                                      
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #16 Posted by aurelio on 1 Nov 2012, 2:55 p.m.,
in response to message #15 by C.Ret

Quote:

Beware that line is 019 %CH (% change instruction) and at line 038 FS?C 09 ( test if flag 9 is set and clear it).


Excuse me, Ret, if I maybe completely misunderstood the code, it means that my review was not so careful!

But If there are no problems to key these lines with the 42's menu, I'm not able to do it with the 41's. May you help me, please?

Edited: 1 Nov 2012, 2:58 p.m.

                                                            
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #17 Posted by C.Ret on 1 Nov 2012, 5:31 p.m.,
in response to message #16 by aurelio

Yes of course.

To key in %CH;

[ XEQ ][ALPHA][shift][ % ][ C ][ H ][ALPHA]

To key in FS?C 09 : [ XEQ ][ALPHA][ F ][ S ][ ? ][ C ][ALPHA] [ 0 ][ 9 ]

The HP41 (as the HP42) have more function and instruction than draw on the keyboard. All function/instruction can be spell using [XEQ][ALPHA].

For exemple keying [XEQ][ALPHA][ S ][ I ][ N ][ALPHA] is equivalent to simply pressing the [ sin ] key.

                                                                  
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #18 Posted by aurelio on 1 Nov 2012, 5:54 p.m.,
in response to message #17 by C.Ret

Thank-you, I just forgot the result of the command [ XEQ ]+[ALPHA]

Edited: 1 Nov 2012, 5:54 p.m.

                                                      
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #19 Posted by Alberto Fenini on 1 Nov 2012, 6:50 p.m.,
in response to message #15 by C.Ret

WORKS !!!
Thank you very much to everyone !
I'll charge my HP67 and HP65 and see how it will works on those :)
thanks again Alberto

                                                            
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #20 Posted by aurelio on 2 Nov 2012, 3:20 p.m.,
in response to message #19 by Alberto Fenini

Hi Alberto, let me know about the 67 performance. you can send me a also a PM if you like Ciao.

                                          
Re: Sell, Cost, Margin for HP41 (God Bless the QWERTY keyboard)
Message #21 Posted by aurelio on 1 Nov 2012, 1:11 p.m.,
in response to message #12 by Alberto Fenini

Quote:
I spare you how tough has been to find the correct key sequence for the FS?C step

This maybe is a typo error, should be I think FS? 09, like 19 %CH should be simply 19 %

Edited: 1 Nov 2012, 2:56 p.m.

      
Re: Sell, Cost, Margin for HP41
Message #22 Posted by aurelio on 29 Oct 2012, 5:08 p.m.,
in response to message #1 by Alberto Fenini

Quote:
(yes, I'm a sales guy, sorry for that

Ciao Alberto, like Telly Savalas, acting in "Capricorn One" movie "I can't help that".................... smiles apart, thank-you for your question (we'll enjoy both, the answer)

I would like to ask also where can I find [in the existing library for HP41-42, earlier or newer RPN (RPL) machines], programs fitted to calculate also (MON) EBIT (MOL) EBITDA or like in the example below

Statement of Income — Example (from Wikipedia)

Revenue

Sales Revenue $20,438

Operating Expenses

Cost of goods sold $7,943

Selling, general and administrative expenses $8,172

Depreciation and amortization $960

Other expenses $138

Total operating expenses $17,213

Operating income $3,225

Non-operating income $130

Earnings before Interest and Taxes (EBIT) $3,355

Financial income $45

Income before Interest Expense (IBIE) $3,400

Financial expense $190

Earnings before income taxes $3,210

Income taxes $1,027

Net Income $2,183

maybe this can be easyly calculated with excel or similar applications, but like Alberto, I love vintage calculators......;)))

Actually I'm not a sales man but in my job since a lot of years we are brought to talk more about money than technical or scientific matter.

Thanks in advance.

Edited: 1 Nov 2012, 1:15 p.m.

      
Re: Sell, Cost, Margin for HP41
Message #23 Posted by Bruce Larrabee on 4 Nov 2012, 7:36 p.m.,
in response to message #1 by Alberto Fenini

Alberto, I'm glad to see that you got so much help with the program. I apologize for not getting back to you. I have been very busy. I will have to adjust my thinking in regards to making offers to help when I actually have so little time.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall