Closed Thread
Results 1 to 7 of 7

Excel 2007 : moving excess amount into different cell

Hybrid View

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    Rehobth, MA
    MS-Off Ver
    Excel 2007
    Posts
    2

    moving excess amount into different cell

    Hi All,

    I am very new at Excell and could use some help. Is it possible to set at max number for a cell and have anything over that set number go to a different cell? An example would be as follows.

    Cell A1 is set at 50. If I type in 67, A1 would stay at 50 and the other 17 would go to a cell of my choice.

    and

    Cell A1 is set at 50. Anything less than 50 would read that value. Say 35 just stays 35.

    Thanks

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: moving excess amount into different cell

    I attached like a sample based on what you described in the post. Just follow the formula logic.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-21-2018
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    2

    Re: moving excess amount into different cell

    Thank you JieJenn…! That attached file had the exact formula that I needed, I had hunted for days seeking this calculation! With appreciation Thank You!

    SpotOn

  4. #4
    Registered User
    Join Date
    07-07-2023
    Location
    Philippines
    MS-Off Ver
    Windows 11
    Posts
    1

    Re: moving excess amount into different cell

    This was very helpful. However what if there are multiple excess numbers that needs to be sum up into a different cell?

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: moving excess amount into different cell

    pharma1,

    Welcome to the forum!

    What you're asking for can be accomplished a couple of ways. If you're okay with different cells changing, you can use formulas. If it has to be the cell you entered into changing, it would need to be a macro.

    Attached is an example workbook that shows both solutions.

    In the formula solution, you enter the number into cell A2. Cell B2 will show that number, maxing out at 50. Cell C2 will show the remainder (if any).
    B2 formula: =MIN(A2,50)
    C2 formula: =IF(A2<=50,"",A2-B2)

    In the macro solution, you enter the number into cell A5. Cell A5 will remain that number if it is 50 or less, but will change to show the max, 50, if you enter a higher number. Cell B5 will show the remainder if any. This is accomplished using a Worksheet_Change event, and here is the code:
    Private Sub Worksheet_Change(ByVal Target As Range)
        
        If Target.Address = "$A$5" Then
            Application.EnableEvents = False
            If Target.Value > 50 Then
                Target.Offset(, 1).Value = Target.Value - 50
                Target.Value = 50
            Else
                Target.Offset(, 1).ClearContents
            End If
            Application.EnableEvents = True
        End If
        
    End Sub
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    02-27-2012
    Location
    Rehobth, MA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: moving excess amount into different cell

    Thanks to the both of you. That will do exactly what I want. The macro was way over my head but the formulas made sense once I looked at them. I'm sure I will be here again for something else.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,972

    Re: Excel 2007 : moving excess amount into different cell

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

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