+ Reply to Thread
Results 1 to 5 of 5

Toggle between sum/date in same cell

  1. #1
    Registered User
    Join Date
    01-15-2014
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Toggle between sum/date in same cell

    Hi guys.

    I'm working with a project where I am trying to produce a worksheet containing
    A) The sum of the order that is to be paid
    B) The date where they have to be paid

    I have created a very simple table with the names of the delivering companies in the columns, and project names in the rows. In each cell I then add the sum of the order that we are going to place. Example:

    Mike's Iron Toys'R'Us
    Project 1 5000 50
    Project 2 20000

    And so on..

    Now, what I need is to be able to click a toggle button (or any other method that works) that switches the sums to dates! Like so:

    Mike's Iron Toys'R'Us
    Project 1 2014-01-15 2014-01-25
    Project 2 2014-02-01

    Preferably I would like to be able to press the button and "clear" all the cells where the sums are already added, and then manually add the dates to the same cells, and then when I press the toggle button again all the sums should return. Then I can switch between sum/date and edit any of the two on the fly, cell by cell. I imagine this would require the worksheet to be duplicated when the button is pressed, cleared of all information except the captions, and then switched between worksheet A and B depending on if the button is pressed or not. But perhaps there is another way?

    I think it would be easier if I would just add the sums and dates separately in other cells and have the togglebutton "gather" the information from the cells and display them in my target cell. But I would really like to edit the cell directly and not have to add values somewhere else. Otherwise I feel that it would take a lot of time getting the toggle button to display the right values (seeing as rows are deleted when the project is fully paid for etc.). The same problem could occur if the worksheet is duplicated somehow; when I delete or add rows when projects are finished/new it feels like it could mess up the code.

    It's a real doozy (is that how you say it?)! I hope anyone can help me with this.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,626

    Re: Toggle between sum/date in same cell

    If you want to stick with your (IMHO - suboptimal :-P) idea of having a button to restore formulas, my advice is as folows:
    prepare sheet with formulas.
    Start registering macro.
    Position cursor in a first cell with formula. Edit (F2) and of course do not change it, just press enter. Then repeat it for all cells with formulas.
    Stop registering.
    Now you have a ready to use macro for filling all cells with formulas. just assign it to a button or other shape and use it.
    so when you need just write the days and when you need to restore formulas - just press a button.

  3. #3
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Toggle between sum/date in same cell

    Not sure how your data looks like, see if this helps?
    Attached Files Attached Files
    多么想要告诉你 我好喜欢你

  4. #4
    Registered User
    Join Date
    01-15-2014
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Toggle between sum/date in same cell

    Kaper: Thanks for your input, not really what I was thinking but I'll try it out just for fun.

    Quote Originally Posted by millz View Post
    Not sure how your data looks like, see if this helps?
    It's really basic, something like your example (it's used to get a quick overview of coming payments).

    I suspected your way might be the easiest (or only) way to do this. The problem, however, is that I would need to keep two different tables and update them accordingly when new projects arrive and old ones are removed.

    I was hoping there is a way to combine these two tables into one - somehow. Meaning I could press the button, and the cells with the dollar value would get wiped (but with the sums remaining "in memory") and allow me to add the dates. And then when I press the button, it will remember both the sums and the dates and switch between the two in the cells when I press the button.

    I completely understand if this is not possible, I just wanted to ask


    Otherwise, I think your example might be the best option. I would just need to find a good way to replicate the table to make sure the dates are inserted in the right cell when I "Switch Data". If there is time, I might try to create some sort of form when adding/removing projects (where I can add the sums and dates at the same time and they are added to two different tables automatically) and then use your example to quickly switch between the two. It's probably too time consuming for this simple thing, that's why I was hoping for a "quick fix"!

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Toggle between sum/date in same cell

    If you want something fun or quirky, do invest some time into making it happen



    Quote Originally Posted by sanzet View Post
    Meaning I could press the button, and the cells with the dollar value would get wiped (but with the sums remaining "in memory") and allow me to add the dates. And then when I press the button, it will remember both the sums and the dates and switch between the two in the cells when I press the button.

    The "memory" you are talking about, can be like another table, just like in the example I have shown.
    You can place it in a different worksheet, and then very hide it. That way, it remembers your data, and yet still seem invisible.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. macro to toggle cell value
    By martindwilson in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-30-2020, 01:38 AM
  2. Click to enter date when toggle button is depressed
    By kevinezra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2013, 12:28 AM
  3. [SOLVED] Toggle cell fill
    By ballan in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-09-2012, 11:02 AM
  4. [SOLVED] Toggle a cell between two values
    By Gunther Maplethorpe in forum Excel General
    Replies: 3
    Last Post: 02-24-2012, 07:30 PM
  5. Toggle Text Color in Cell A, when Cell B clicked...
    By woodman650 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2008, 02:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1