home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / utility / pbaseiv.zip / P4SPR003.TIP < prev    next >
Text File  |  1991-12-16  |  3KB  |  80 lines

  1. I've discovered a way for one Quattro Pro worksheet to look
  2. up data in another. For instance, if you keep a table of
  3. sales tax rates in one file where it can be easily updated,
  4. you can use that data to calculate the sales total in
  5. another. This same technique can be used for other types of
  6. information, such as minimum order or discount levels; the
  7. effect is very much like that of a relational data base.
  8.  
  9. The worksheets SALES.WQ1 and TAXRATES.WQ1 [illustrated below
  10. and included in the P4SPREAD directory on your PowerBase
  11. *.* Volume IV disk] show how this works. To try them out,
  12. copy both to your hard disk, make their directory the
  13. current one, and load SALES.WQ1. Then, adjust the paths in
  14. cells A1 and B2 to specify the complete pathname of
  15. TAXRATES.WQ1 (e.g. C:\WORK\TAXRATES.WQ1). When you enter a
  16. state abbreviation in cell B1 of SALES (you can use capitals
  17. or lowercase letters) and a dollar amount in cell B3, you'll
  18. get a sensible label in A2, plus the calculated state tax
  19. and total in cells B4 and B6.
  20.  
  21. The secret to this trick is the formula
  22.  
  23. `@@("[taxrates.wq1]"&B1)'
  24.  
  25. in cell B2 of SALES.WQ1. This dynamic link fetches a value
  26. from the cell in TAXRATES.WQ1 whose range name matches the
  27. string in B1. Since the state abbreviations (in column A of
  28. TAXRATES.WQ1) are range names for the tax rates (in column
  29. B), this amounts to looking up the tax rate in a table.
  30.  
  31. This technique has one slight quirk: Quattro Pro does not
  32. recognize this kind of formula as a link between worksheets.
  33. Therefore it will not remind you to load the supporting file
  34. (TAXRATES, in this example) when you load the main
  35. worksheet, and the supporting file must be open in order for
  36. the link to work. The solution is to put a more
  37. "conventional" link in the main worksheet, such as the
  38. formula `+[taxrates.wq1]A1' that is shown in cell A1.
  39.  
  40. David H. Smiley
  41. Virginia Beach, Virginia
  42.  
  43. Editor's note: If all your potentially related files are in
  44. the same directory, you don't need to include full paths in
  45. your linking formulae. Including the path, however, will
  46. give you the freedom to keep those files in separate
  47. directories and access them regardless of the current
  48. directory. Finallly, please note that the sample worksheets
  49. oversimplify the task of sales and use tax calculation. Many
  50. states have hundreds of different jurisdictions with
  51. different tax rates.
  52.  
  53. TAXRATES.WQ1, a sample Quattro Pro sales tax worksheet, is
  54. used as a lookup table by SALES.WQ1.
  55.  
  56.         A        B
  57. 1   State    Sales Tax
  58. 2   NC       5.0%
  59. 3   PA       6.0%
  60. 4   VA       4.5%
  61.  
  62. SALES.WQ1, a sample Quattro Pro worksheet, uses state sales
  63. tax information from TAXRATES.WQ1 to calculate the full cost
  64. of a sale.
  65.  
  66.                 A                               B
  67. 1   +[taxrates]A1
  68. 2   @UPPER(B1)&" tax rate"          @@("[taxrates.wq1]"&B1)
  69. 3   Sale
  70. 4   State tax                       +B3*B2
  71. 5                                   \-
  72. 6   Total                   +B3+B4
  73.  
  74. Title: Looking Up Quattro Pro
  75. Category: SPR
  76. Issue date: Jun 1991
  77. Editor: Karl Koessel
  78. Supplementary files: P4SPREAD\TAXRATES.WQ1,
  79.                      P4SPREAD\SALES.WQ1
  80.