# Pricing algorithm using Let function

Question asked by PeterMontague on May 30, 2013
Latest reply on Jun 10, 2013 by philmodjunk

### Title

Pricing algorithm using Let function

### Post

I've been trying to work out a pricing algorithm using Let functions. I'm having a couple of problems.

1.           I would like to reference the next seller instead of using seller 1, seller 2 etc. How do I achieve that in a calculation?
2.
3.           I would also like to exclude certain sellers from the pricing comparison. I tried that with:

Excluded seller 1 = Seller 1  = "Tolka Unused Books" or Seller 1  = "Book-Fare";

But it doesn't seem to be working at excluding these sellers when I use this calcualtion:
Optimum price = If ( Seller 1 ≠ Excluded seller 1 ; (Price 1 + Shipping 1  - Amazon shipping) * .99 ; (Price 2 + Shipping 2 - Amazon shipping) * .99 )
These sellers are not being excluded.
Here is the whole calcuation: Have you any advice?

Let ( [
Price 1 = Parse ( Inventory::source_bookfinder ; "x3b" ; "\x3c" ; 1 ) ;
Shipping 1 = Parse ( Inventory::source_bookfinder ; "Shipping cost\x3c\x2fth\x3e\x3ctd\x3e\x26pound\x3b" ; "\x3c" ; 1 ) ;
Price 2 = Parse ( Inventory::source_bookfinder ; "x3b" ; "\x3c" ; 2 ) ;
Shipping 2 = Parse ( Inventory::source_bookfinder ; "Shipping cost\x3c\x2fth\x3e\x3ctd\x3e\x26pound\x3b" ; "\x3c" ; 2 ) ;
Seller 1 = Parse ( Inventory::source_bookfinder ; "<td class=\"results-table-center\"><span class=\"results-explanatory-text-Logo\">" ; "</span>" ; 1 ) ;
Excluded seller 1 = Seller 1  = "Tolka Unused Books" or Seller 1  = "Book-Fare";
Amazon shipping = "2.80" ;
Optimum price = If ( Seller 1 ≠ Excluded seller 1 ; (Price 1 + Shipping 1  - Amazon shipping) * .99 ; (Price 2 + Shipping 2 - Amazon shipping) * .99 )
] ;
If (Optimum price  ≥ Inventory::floor; Optimum price ; Inventory::floor )
)