(HP67 app) Pricing Calculation with known Markup for new Price comparison.
10-19-2017, 08:03 PM (This post was last modified: 10-19-2017 08:42 PM by Dieter.)
Post: #2
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison.
(10-16-2017 01:38 PM)Gamo Wrote:  I still can't find the way to do this pricing calculation method just by press the two known variables and get the answer for the other two variables.
For example: when you know Cost and Margin you get answer for Price and Markup. Just by input A and D then press B and C for instant answer.

That's not trivial, for several reasons. For instance there are multiple ways to calculate each of the four variables, depending on which ones are known are which are not. Then there are cases where no unique solution exists (e.g. if only markup and margin are given).

Here is a program that does what you want. Enter any two of the four variables, and the other two are calculated. The program uses a method that I already implemented more than 30 years ago for a triangle solver (enter any three... you get the picture). If a variable is entered, a constant of 1 (cost), 2 (price), 4 (markup) or 8 (margin) is added to R0. This way each of the six possible cases produces a unique sum:

cost & price => 3
cost & markup => 5
price & markup => 6
cost & margin => 9
price & margin => 10
markup & margin => 12

The last case can be neglected since no unique solution for cost and price exists if only markup and margin are given.

Now the program can simply jump to the label with that number to start the calculation. Actually it jumps to a label with that number minus 3 because this way all results are between 0 and 9 and the labels above (LBL A = #10) can be used without interfering with the calculation routines.

Pressing [E] initializes the program. After two values have been entered (counted by a DSZ command) the calculation routine at LBL e starts. LBL a and b hold some calculations that appear several times. Afterwards pressing one of the keys [A]...[D] shows the respective result.

Here is the listing:

Code:
001  LBL E 002  FIX 003  DSP 2 004  2 005  STO I 006  CLX 007  STO 0 008  STO 1 009  STO 2 010  STO 3 011  STO 4 012  CF 3 013  RTN 014  LBL A 015  F3? 016  F3? 017  GTO c 018  1 019  STO+0 020  R↓ 021  STO 1 022  DSZ 023  RTN 024  GSB e 025  LBL c 026  RCL 1 027  RTN 028  LBL B 029  F3? 030  F3? 031  GTO c 032  2 033  STO+0 034  R↓ 035  STO 2 036  DSZ 037  RTN 038  GSB e 039  LBL c 040  RCL 2 041  RTN 042  LBL C 043  F3? 044  F3? 045  GTO c 046  4 047  STO+0 048  R↓ 049  STO 3 050  DSZ 051  RTN 052  GSB e 053  LBL c 054  RCL 3 055  RTN 056  LBL D 057  F3? 058  F3? 059  GTO c 060  8 061  STO+0 062  R↓ 063  STO 4 064  DSZ 065  RTN 066  GSB e 067  LBL c 068  RCL 4 069  RTN 070  LBL e 071  RCL 0 072  3 073  - 074  STO I 075  GTO(i) 076  LBL 0 077  GSB a 078  GTO b 079  LBL 2 080  RCL 1 081  RCL 3 082  % 083  + 084  STO 2 085  GTO b 086  LBL 3 087  RCL 2 088  1 089  RCL 3 090  % 091  + 092  / 093  STO 1 094  GTO b 095  LBL 6 096  RCL 1 097  1 098  RCL 4 099  % 100  - 101  / 102  STO 2 103  GTO a 104  LBL 7 105  RCL 2 106  RCL 4 107  % 108  - 109  STO 1 110  LBL a 111  RCL 1 112  RCL 2 113  %CH 114  STO 3 115  RTN 116  LBL b 117  RCL 2 118  RCL 1 119  %CH 120  CHS 121  STO 4 122  RTN

Here is an example:

Code:
Initialize        [E]     0,00 Enter cost   110  [A]   110,00 Enter price  165  [B]   165,00 Get markup        [C]    50,00 Get margin        [D]    33,33

All data can now be recalled by pressing the [A] to [D] keys.
Be sure to press none of the number entry keys because else this will be considered a new data input.

Code:
Get cost          [A]    110,00 Get price         [B]    165,00 Get markup        [C]     50,00 Get margin        [D]     33,33

Another example:

Code:
Initialize        [E]     0,00 Enter cost   110  [A]   110,00 Enter markup  50  [C]    50,00 Get price         [B]   165,00 Get margin        [D]    33,33

You can also try any other combination. Including markup & margin. Try it: it will result in an "Error" message.

Note: data entry is detected by flag 3 which, on the '67 and '97, is set if you enter data with the number entry keys. It is not set if you recall a value from a register. So if you want to do so press any number key before. If you want you can change this to another method, e.g. consider only non-zero values as data entry. In this case simply replace the double F3? tests (which behaves like a FC?C 03) by an "X=0?" test.

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 10-16-2017, 01:38 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Dieter - 10-19-2017 08:03 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 10-20-2017, 05:47 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - PANAMATIK - 10-20-2017, 06:50 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Dieter - 10-20-2017, 07:52 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 10-20-2017, 09:07 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Dieter - 10-20-2017, 04:58 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 10-23-2017, 01:52 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 02-09-2018, 08:14 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Dieter - 02-09-2018, 08:35 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 02-09-2018, 02:20 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Dieter - 02-09-2018, 06:51 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 02-10-2018, 03:04 AM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gene - 02-10-2018, 02:05 PM RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison. - Gamo - 06-18-2019, 01:12 PM

User(s) browsing this thread: 1 Guest(s)