5 Replies Latest reply: Sep 2, 2013 1:38 AM by Barry
domasfromleeds Level 1 Level 1 (0 points)

I need a simple button which would add 1 to one cell and would insert todays date to another.

Mac OS X (10.5.6)
  • Barry Level 7 Level 7 (29,455 points)

    A Stepper formatted cell might do what you want for the first.


    Insert Data and Time is a menu item in the Insert menu. By default inserts the current date (with the time part set to 00:00:00). It's at top evel in the menu, not n a submenu, so you could define a keyboard shortcut for it.


    Numbers doesn't support buttons that trigger actions, though.




  • Perite Level 1 Level 1 (0 points)

    For the sake of others who may be interested, you can use a Checkbox as a button.


    1. Format the "button" cell as a check box

    2. Place an IF statment in your output cell that delivers whatever result you want depending on whether the checkbox is checked or not.


    eg.  If the checkbox was in cell A2 then a simple formula just to illustrate the point would be = IF(A2,1,0)


    When the checkbox is ticked the output cell will contain the value 1, and 0 when it isn't.  Because any number or text can be output by an IF statement, the checkbox can do anything you like when the IF statement is incorporated within some other function.



  • Barry Level 7 Level 7 (29,455 points)

    Hi Perite,


    Checkboxes can be used in connection with IF to toggle output of the IF statement between two pre set values, but that doesn't solve the OP's request to have the 'button' perform the two actions described:


    1 Increment the value of a cell by one.

    2 Insert the current date in another cell.


    How will the output of "any number or text" fulfill either of these requirements?




  • Perite Level 1 Level 1 (0 points)

    Hi Barry,


    I didn't try to answer domasfromleedsquestion as it was already answered by your good self.


    I found his question and your answer when searching for a solution to a slightly different problem;  in keeping track of my grid solar outout I wanted to click a button to view a weekly average optionally excluding "today" so I can check my figures first thing in the morning.


    The function that calculates the weekly average automatically updates the day count to include today when the spread sheet opens.


    Using the checkbox as a true/false flag my formula conditionally subtracts 1 from the count of days.


    Others, like me, may be searching for some form of interactive solution and a checkbox provides a simple way to conditionally branch, using an easy to click and visible flag.





  • Barry Level 7 Level 7 (29,455 points)

    Hi Phil,


    Good use of a checkbox.

    Thanks for the explanation.