Electronic spreadsheet

Abstract: An electronic spreadsheet consists of an array of cells into which a user can enter formulas and values. The contents of the spreadsheet cells are translated into a query in a high-level logic language such as PLL. The query is then re-written according to the rules of the logic language, to produce an answer. The answer is then translated back into formulas and values which can be displayed on the spreadsheet. The system provides a number of facilities not available on conventional electronic spreadsheets: it provides the ability to give generalised answers containing formulas rather than simply numbers, and provides the ability to solve goal-seeking problems, working backwards from a desired result.

Description: Background to the Invention This invention relates to electronic spreadsheets. Electronic spreadsheets are widely used in computer systems, for applications such as accounting and planning. Typically, a spreadsheet consists of an array of cells, displayed on a screen, into which the user can enter values or formulas. When requested by the user, the system automatically calculates the results of the formulas and displays these results in the appropriate cells of the spreadsheet. A known electronic spreadsheet is described in "A spreadsheet interface for logic programming" Spenke, M et al, Proceedings of the CHI '89, May 1989, pages 75-80. This spreadsheet is such that a user can enter input values and input formulas into cells of the spreadsheet. The contents of the cells are then converted into queries and rewritten to produce output values which are then displayed in respective cells. The object of the present invention is to provide an improved electronic spreadsheet which is capable of providing more facilities than a conventional spreadsheet. Summary of the Invention According to one aspect of the invention there is provided an electronic spreadsheet system comprising: (a) user interface means for displaying a spreadsheet and allowing a user to enter input formulas and input values into cells of the spreadsheet, each input value being displayed in a respective cell, and each input formula being displayed in a respective cell and including at least one variable whose value corresponds to the value of another cell, the variable being indicated in the displayed input formula by the name of the other cell, (b) means for converting the contents of the spreadsheet cells into a query in a high level logic language, (c) means for rewriting the query according to predetermined logic rules to produce an answer, and (d) means for converting the answer into an output value for display in a respective cell of the spreadsheet when an output value is determinate, and characterised by (e) means for converting the answer into an output formula for display in a respective cell of the spreadsheet, an output formula arising when an output value is indeterminate, either each output formula including at least one variable whose value is indeterminate and corresponds to the value of another cell, the indeterminate value being indicated in the displayed output formula by the name of the other cell, or each output formula including at least one said variable whose value is indeterminate and at least one value. According to another aspect of the invention there is provided a method of producing an electronic spreadsheet comprising the steps of: (a) entering input formulas and input values into a plurality of cells in a spreadsheet display, each input value being displayed in a respective cell, and each input formula being displayed in a respective cell and including at least one variable whose value corresponds to the value of another cell, the variable being indicated in the displayed formula by the name of the other cell, (b) converting the contents of the cells into a query in a high level logic language, (c) rewriting the query according to predetermined logic rules to produce an answer, and (d) converting the answer into an output value and displaying the output value in a respective cell of the spreadsheet when an output value is determinate, and characterised by (e) converting the answer into an output formula and displaying the output formula in a respective cell of the spreadsheet when an output value is indeterminate, either each output formula including at least one variable whose value is indeterminate and corresponds to the value of another cell, the indeterminate value being indicated in the displayed output formula by the name of the other cell, or each output formula including at least one said variable whose value is indeterminate and at least one value. Brief Description of the Drawings Figure 1 is a block diagram showing an electronic spreadsheet system in accordance with the invention. Figures 2-8 show examples of displays produced by the electronic spreadsheet system. Description of an Embodiment of the Invention One electronic spreadsheet system in accordance with the invention will now be described by way of example with reference to the accompanying drawings. Referring to Figure 1, the system comprises a user interface 10, a symbolic interpreter 11, a logic processor 12. Each of the modules is conveniently implemented by software means, running on a conventional computer system. The user interface 10 handles all communication with the user, by way of a conventional window operating system 13. In particular, the user interface 10 creates a spreadsheet display, and allows the user to edit and update the spreadsheet by inserting values and formulas into the cells of the spreadsheet. Formulas and values can be saved in a file 14 and then re-loaded into the spreadsheet when required by the user. The values in the spreadsheet cells may be numbers, strings or lists. The formulas may involve arithmetic, logic, comparison, string or list operators, or user-defined functions. The symbolic interpreter 11 examines the contents of each spreadsheet cell in turn, and converts or translates them into rules in a high-level logic language which in this example is PLL. The language PLL is described in "Pure logic language" by E. Babb, ICL Technical Journal, Published by International Computers Ltd at Oxford University, England, May 1989. This conversion includes supplying any variables and operators which are implicit in the spreadsheet format. For example, if cell x contains a formula y+2, then this is translated into a rule of the form x=y+2; i.e. the cell name "x" and the operator "=" are supplied explicitly. In the case of a user-defined function, this is interpreted according to the function definition supplied by the user in a file 15. The first argument of each such function is assumed to be the name of the cell in which the function is located, and so the interpreter 11 must supply this variable explicitly when converting the function reference. The symbolic interpreter 11 then constructs a PLL query, comprising the AND of all the rules for the individual cells, and passes this to the logic processor 12. The logic processor 12 receives the query, and processes it by re-writing it according to the rules of the PLL language, to provide an answer to the query. This involves simplifying the query where possible. For example, a query of the form. x = y + 2 & y = 3 would be re-written to provide an answer in the form x = 5 & y = 3 The answers produced by the logic processor 12 are then passed back to the symbolic interpreter 11, which then converts the answers into formulas and values for displaying on the spreadsheet. For example, the answer x = 5 & y = 3 would cause the value 5 to be displayed in cell x and the value 3 to be displayed in cell y of the spreadsheet. Referring now to Figure 2, this shows an example of a typical display produced by the electronic spreadsheet system. The display comprises an array of cells, arranged in columns A, B,... and rows 1, 2, .... Each cell is referenced by its row and column position: for example, the top left-hand cell is cell al. The boxes at the top of the display labelled "Quit", "Calc" etc are used as buttons, to trigger a desired action. These are used in conjunction with a pointing device, such as a mouse. In order to select an action, the mouse is used to position a cursor in the desired box, and a control button on the mouse is then pressed to initiate the action. This is referred to as "clicking" on the selected button. The functions of the buttons are as follows: Calc - clicking on this button causes the system to calculate the results of the formulas in the spreadsheet, and to display the results. This involves activating the symbolic interpreter 11 and logic processor 12 to convert and re-write the formulas as described above. As will be described later, there may be more than one set of results for a particular set of formulas. In this case, each time the Calc button is clicked, a further set of results is displayed. When all the sets of results have been displayed, clicking again on the Calc button returns to the originally displayed formulas. Quit - where there is more than one set of results, and not all of them have been displayed yet, clicking on this button causes the further sets of results to be ignored and returns to the originally displayed formulas. Otherwise, it exits from the spreadsheet. Load - loads formulas from the file 14 into the spreadsheet. Save - saves formulas from the spreadsheet into the file 14. Fetch - fetches the rules from the file 15. Figure 2 shows an example of use of the spreadsheet to calculate expense claims for car mileage. In this example, the cells are defined as follows: b2 - current mileage b3 - total mileage brought forward b4 - total mileage carried forward (b2+b3) c5 - rate per mile, excluding value added tax (VAT) c6 - VAT element per mile d5 - expense claim, excluding VAT (b2 x c5/100) d6 - VAT element of expense claim (b2 x c6/100) d7 - total claim (d5 + d6) To use the spreadsheet in this example, the user would normally type the current mileage into box b2, and then click on the Calc button. The result is as shown in Figure 3. It can be seen that all the formulas have been replaced by numerical results. For example, box d7 indicates that the total expense is £8.3517. In the example illustrated in Figures 2 and 3, the spreadsheet produces the same results as a conventional spreadsheet. However, the invention also provides further facilities not available on conventional spreadsheets, as will now be described. Referring to Figure 4, this shows the same spreadsheet as in Figure 2, except that in this case the value in cell b2 has been deleted. This makes b2 a variable value. If the user now clicks on the Calc button, answers are displayed as shown in Figure 5. It can be seen that in this case, some of the answers are formulas, rather than numeric values, because the logic processor 12 was not able to simplify the query any further. For example, box b4 contains the formula b2 + 1327. Thus, the present system provides the ability to give generalised answers containing formulas as well as numbers, where some of the necessary values are unknown. This facility is not available on conventional spreadsheet systems. Referring now to Figure 6, this again shows the same spreadsheet as in Figure 2, except that in this case the value in cell c5 has been deleted, and cell d7 has been modified by adding "&9". The effect of this is to make c5 a variable, and to specify that the cell d7 must have the value 9. If the user now clicks on the Calc button, answers are displayed as shown in Figure 7. It can be seen that, in this case, the system has calculated a value 6.42707 for cell c5 which gives the required result 9 in cell d7. Thus, the system provides the ability to solve goal-seeking problems; that is, to calculate backwards to obtain the input values that would be required to get a particular desired answer. This facility is not available on conventional spreadsheet systems. Referring now to Figure 8, this shows the same spreadsheet as in Figure 6, but in this case, two alternative values 123 and 124 have been inserted in cell 2 using the vertical stroke symbol to indicate the logic operator "OR". In this case, when the user clicks on the Calc button, the system will display answers calculated using the first of these alternatives: for example, the formula in cell b4 is replaced by the value 1450. If the user now clicks again on the Calc button, the second alternative is displayed: for example, b4 shows 1451. The system is also able to handle the case where alternatives are presented in more than one cell. In this case, answers are calculated for each possible combination of these alternatives. For example, if there are two alternative values for cell b2 and two alternatives values for cell c5, then there are four possible values for cell d5 for example, each of which can be displayed in turn by clicking on the Calc button. It should be noted that many modifications of the system described above may be made. In particular, in a practical spreadsheet system, there would normally be more rows and columns of cells than in the example described above.

Claims: An electronic spreadsheet system comprising: (a) user interface means (10) for displaying a spreadsheet and allowing a user to enter input formulas and input values into cells of the spreadsheet, each input value being displayed in a respective cell, and each input formula being displayed in a respective cell and including at least one variable whose value corresponds to the value of another cell, the variable being indicated in the displayed input formula by the name of the other cell, (b) means (11) for converting the contents of the spreadsheet cells into a query in a high level logic language, (c) means (12) for rewriting the query according to predetermined logic rules to produce an answer, and (d) means (11) for converting the answer into an output value for display in a respective cell of the spreadsheet when an output value is determinate, and characterised by (e) means (11) for converting the answer into an output formula for display in a respective cell of the spreadsheet, an output formula arising when an output value is indeterminate, either each output formula including at least one variable whose value is indeterminate and corresponds to the value of another cell, the indeterminate value being indicated in the displayed output formula by the name of the other cell, or each output formula including at least one said variable whose value is indeterminate and at least one value. A method of producing an electronic spreadsheet comprising the steps of: (a) entering (10) input formulas and input values into a plurality of cells in a spreadsheet display, each input value being displayed in a respective cell, and each input formula being displayed in a respective cell and including at least one variable whose value corresponds to the value of another cell, the variable being indicated in the displayed formula by the name of the other cell, (b) converting (11) the contents of the cells into a query in a high level logic language, (c) rewriting (12) the query according to predetermined logic rules to produce an answer, and (d) converting (11) the answer into an output value and displaying the output value in a respective cell of the spreadsheet when an output value is determinate, and characterised by (e) converting (11) the answer into an output formula and displaying the output formula in a respective cell of the spreadsheet when an output value is indeterminate, either each output formula including at least one variable whose value is indeterminate and corresponds to the value of another cell, the indeterminate value being indicated in the displayed output formula by the name of the other cell, or each output formula including at least one said variable whose value is indeterminate and at least one value.

Inventors: BABB EDWARD, WEST VINCENT DAVID, BABB, EDWARD, WEST, VINCENT DAVID
Applicants: INT COMPUTERS LTD, INTERNATIONAL COMPUTERS LIMITED
Application year: 1991
Main classification: G06F17
IPC codes: G06F15, G06F17, G06Q10