+ Reply to Thread
Results 1 to 20 of 20

Need Help making the formula in a Cell Constant

  1. #1
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Need Help making the formula in a Cell Constant

    I want to have the formula in a cell always constant. I know I can use "$B$5". But when I enter some value into that particular cell the formula is getting erased.

    Can someone please help me with this?

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    A cell can only contain a formula OR a value.
    It cannot contain both.

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,075

    Re: Need Help making the formula in a Cell Constant

    Jonmo1 is correct - you can only have either a formula or a value in cell B5. What are you trying to achieve?
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

  4. #4
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    Hi Tuph and Jonmo1 thanks for your response,

    I'm trying to create three columns which are start date, end date and the count.
    I need to have them dynamic where when one of the values gets updated I want the other two to update themselves.


    For example: Start Date End Date No of Days

    1/1/2014 1/10/2014 10

    1/10/2014 1/15/2014 5

    and so on...

    If I change the end date 1/15/2014 then the no of days should update itself or If I change the no of days then, the dates should get updated depending on the change.

    Please help!

    Thank you

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Need Help making the formula in a Cell Constant

    that sounds like a simple datedif formula under # of days (assume it is in C2) =datedif(a2,b2,"d") and it will recalculate.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    Quote Originally Posted by balu.soln4biz View Post
    If I change the end date 1/15/2014 then the no of days should update itself or If I change the no of days then, the dates should get updated depending on the change.
    You're not going to be able to do that with formulas. It will require VBA code.
    It's one thing to calculate the number of days based on the 2 date entries.
    But to then also have the Date's update if you change the number of Days (replace the formula by hand), that won't work.

    Is a VBA solution useable in your book?
    If so, can you give more details.

    Which date (start or end) should change when you change the 'No of days' value ?

    And which version of XL are you using?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need Help making the formula in a Cell Constant

    One way, perhaps:

    A
    B
    C
    D
    1
    Start
    01/01/2014
    01/01/2014
    C1: =IF(COUNT(B1:B3)<>2, "", IF(ISNUMBER(B1), B1, B3-B2))
    2
    Days
    9
    C2: =IF(COUNT(B1:B3)<>2, "", IF(ISNUMBER(B2), B2, B3-B1))
    3
    End
    01/10/2014
    01/10/2014
    C3: =IF(COUNT(B1:B3)<>2, "", IF(ISNUMBER(B3), B3, B1+B2))


    Enter two of three values in B1:B3.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    The start date can be constant.. but the end date need to change when we change the number of days.. and vice the number days need to get updated when we change either of the start or end dates.

    I'm using 2013 Excel..

    If you can help me fix this that would be very helpful.

    Capture.JPG

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    Try this code
    Right click your sheet's tab, view code
    Paste the following

    Please Login or Register  to view this content.
    Last edited by Jonmo1; 06-04-2014 at 02:22 PM.

  10. #10
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    I have tried this code but I wasn't able to see the macro once after I save it.. Its very weird. Have you tried the macro in your excel?

    Quote Originally Posted by Jonmo1 View Post
    Try this code
    Right click your sheet's tab, view code
    Paste the following

    Please Login or Register  to view this content.

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    It's not a macro that you would run from the macros menu (it won't be listed there).
    It's an Event procedure that runs automatically when you change the values in the cells.

    Make sure you follow the steps I posted
    Right click your sheet's tab
    Select View Code
    Paste the code there.

    Now when you change the values in columns B C or D, the appropriate values will be automatically adjusted.

  12. #12
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    That's working!! Amazing! Thank you very much Jonmo1.

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    You're welcome.

  14. #14
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    Jonmo its working fine but I have a small problem.

    If you saw my screenshot, end dates on each row are related to the start dates on the immediate next rows. So when any of the columns are updated, its supposed to change the rest. But in this case other rows are static so when one of the rows is updated the others are going to be wrong if not updated!

  15. #15
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    You said..

    Quote Originally Posted by balu.soln4biz View Post
    The start date can be constant..
    I would put a formula in B3 and filled down
    =D2

  16. #16
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    And change the code to
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    Yes, the first start date is constant and I have done the same but ( b3=D2).. When I change the number of days, its changing the end date on the same row but the number of days and end date on the next row( and also the following rows) is not being updated. so the data looks incorrect!

  18. #18
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    Sorry, but it's making my head hurt trying to think about how to handle all that.

    I think you're making this harder than it has to be.

    I honestly think you should re-think the purpose of the sheet.
    And pick ONE, make it so you can
    Either:
    1: Change the end date, and make the number of days (and next row start date) adjust via a formula.
    OR
    2: Change the number of days, and make the end date (and next row start date) adjust via a formula.

    Not both.

  19. #19
    Registered User
    Join Date
    06-02-2014
    Posts
    18

    Re: Need Help making the formula in a Cell Constant

    Jonmo1 really appreciate your help, Imagine my situation here and its not the entire problem, there are dependencies for each row again. I have to get it work with the dependencies as well . There should be another column with the dependent rows where the rows changes their dates depending on the dependencies given.

    Thank you so much for your time my friend. Have a great day!

  20. #20
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Help making the formula in a Cell Constant

    You're welcome.
    Sorry we couldn't achieve your goal.

+ 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. Replies: 5
    Last Post: 09-05-2012, 10:52 AM
  2. Making a constant and a variable in excel 2007
    By AKW in forum Excel General
    Replies: 3
    Last Post: 11-23-2008, 03:26 PM
  3. Making a Constant Row
    By Juan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2006, 09:29 PM
  4. Replies: 2
    Last Post: 12-14-2005, 09:40 PM
  5. Making Excell formula constant
    By darsg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2005, 12:06 PM

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