+ Reply to Thread
Results 1 to 9 of 9

Calculate or input value

  1. #1
    Registered User
    Join Date
    04-15-2024
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    4

    Calculate or input value

    Hi
    I have the following example:

    What I want to achieve is the ability for the user to input the value in C1 and the cell B1 gets update or they simply enter the %age in B1 and C1 is calculated.
    So the user has the option to either enter %age in B1 or Enter the Value in C1 and B1 gets updated.

    A1 B1 C1
    100 10% 10

    Thanks

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Calculate or input value

    If you want to do this with three cells, exactly as you have described, you need VBA.

    To do this with only formulas requires another cell with conditional formatting. Here is the same solution shown twice, putting the values in two different cells. The user puts a value in B1 or C1, then D1 shows the calculated value.

    Values as displayed
    A
    B
    C
    D
    1
    Some Value
    Percentage
    Value
    Value
    2
    100
    10%
    10
    noshali


    Underlying formulas
    A
    B
    C
    D
    1
    =IF(OR(B2&C2="",AND(B2<>"",C2<>"")),"",IF(B2<>"",C1,B1))
    2
    =IF(OR(B2&C2="",AND(B2<>"",C2<>"")),"",IF(B2="",C2/A2,B2*A2))


    Conditional Formatting Rules
    Formula
    Applies To Formula Format Stop If True
    $D$2 =$C$2<>"" 0% False
    noshali


    Values as displayed
    A
    B
    C
    D
    1
    Some Value
    Percentage
    Value
    Percentage
    2
    100
    10
    10%
    noshali
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-15-2024
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Calculate or input value

    Thanks a lot...very helpful

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Calculate or input value

    I can do a VBA solution too if you want to go that direction.

  5. #5
    Registered User
    Join Date
    04-15-2024
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Calculate or input value

    Thanks...sure...please note the I need to do this across many rows and also rows keep getting added or deleted.
    Really appreciate your help.

    A1 B1 C1
    100 10% 10
    200 5% 10

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Calculate or input value

    It's better to give a complete explanation of your question up front. My answer addressed exactly what you asked in the first post.

    The same solution can be applied to as many rows as you want. If you use a Table, then the formula will automatically be added if you add rows. The only problem with multiple rows is you cannot have the dynamic header because some rows will be value, some will be percentage.

    If you still cannot work out how to apply this solution to your file, please attach a sample file. See yellow banner at the top of the page.

  7. #7
    Registered User
    Join Date
    04-15-2024
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Calculate or input value

    Hi
    Please find attached the sample file.
    The idea is to have the ability to either enter the percentage in Column E or enter the amount in Column F.
    My users sometimes take the amount off an invoice and enter it and there are times when they simply enter the percentage based on what they feel has been completed.
    If they enter the amount the percentage filed should update. If they enter the percentage then the amount should update. It is currently setup to enter the percentage. To enter the amount I have to manually use the solver function so that the percentage gets updated.
    Thanks & regards,
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,987

    Re: Calculate or input value

    You can't do this with a formula. A cell can contain EITHER a formula OR a hard-coded value, but not both. You'd need VBA.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Calculate or input value

    In your file, the relationship is between column D and E, not E and F. Are you sure you want to let the user change the value in column F? If you do, it's a different question than what you asked in your first post.

    Values as displayed
    D
    E
    F
    3
    Completed
    Percentage
    Current
    4
    to Date
    Complete
    Invoice
    5
    (D/B)
    (D-C)
    6
    7
    $ 3,000.00
    15%
    $ 1,000.00
    D17 (2)


    Underlying formulas
    D
    E
    F
    3
    4
    5
    6
    7
    =B7*E7
    =D7-C7

+ 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. Calculate with different input, than copy paste
    By RubenvanEwijk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2015, 10:12 AM
  2. how to calculate the ressult from input 1 and 2
    By vho in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2014, 03:44 AM
  3. Replies: 0
    Last Post: 03-25-2014, 03:04 AM
  4. Calculate whether input response is late
    By dfhallam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2014, 05:10 PM
  5. Formula to calculate the cell from input in 2 other cells
    By Ludolphian in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 09-03-2013, 03:52 PM
  6. Calculate and graph from varying input dates
    By devplan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-26-2011, 08:07 AM
  7. Replies: 5
    Last Post: 07-28-2009, 11:21 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