+ Reply to Thread
Results 1 to 13 of 13

remaining quantity bar (related to total quantity)

Hybrid View

vermaccio remaining quantity bar... 06-08-2023, 03:04 AM
leelnich Re: remaining quantity bar... 06-08-2023, 06:08 AM
torachan Re: remaining quantity bar... 06-08-2023, 07:20 PM
vermaccio Re: remaining quantity bar... 06-09-2023, 02:38 AM
leelnich Re: remaining quantity bar... 06-09-2023, 06:37 AM
leelnich Re: remaining quantity bar... 06-09-2023, 07:11 AM
torachan Re: remaining quantity bar... 06-09-2023, 05:44 AM
Glenn Kennedy Re: remaining quantity bar... 06-09-2023, 06:01 AM
AliGW Re: remaining quantity bar... 06-09-2023, 06:06 AM
Glenn Kennedy Re: remaining quantity bar... 06-09-2023, 06:08 AM
AliGW Re: remaining quantity bar... 06-09-2023, 06:09 AM
vermaccio Re: remaining quantity bar... 06-09-2023, 09:02 AM
torachan Re: remaining quantity bar... 06-09-2023, 01:13 PM
  1. #1
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    132

    remaining quantity bar (related to total quantity)

    i have 2 columns:

    first column= total quantities
    second column= remaining quantities

    i need a bar for every row showing the remaining quantity referred to total quatity (for every row)

    i tried with conditional formatting but the higher total value influence the bar lenght of all the other rows: instead, every row bar should be indipendent from other rows.

    see attached file with conditional formatting i tried.
    Attached Files Attached Files

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: remaining quantity bar (related to total quantity)

    I've never found a way to make Data Bars work w relative references. I think you'd have to define CF for each row individually...YUCK. Maybe someone else knows a work-around. Apologies if you've already thought of this, but the only thing I can offer is a couple of ways to show progress in a separate column. Here's a picture:

    InStock2.png

    Method#1 employs repeated pipe characters ("|") generated with a formula:=IFERROR(LEFT(REPT("|",23),23*M6/K6),""). Pretty basic.
    Method#2 uses Data Bars in the center column set to reflect the underlying percentages yielded by this formula: IFERROR(M6/K6,"").
    You'll need to set the Min Value to 0, the Max Value to 1, and check the Show Bar Only box in the CF dialog box.
    Attached Files Attached Files
    Last edited by leelnich; 06-14-2023 at 01:27 PM. Reason: Added DataBar Settings to picture.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: remaining quantity bar (related to total quantity)

    give the attached a trial - put your remaining qty in 'M6' downwards - green bar should be proportional to qty - red bar if error.
    Macro on Worksheet_Change event.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  4. #4
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    132

    Re: remaining quantity bar (related to total quantity)

    torachan: thank you but i would prefer to avvoid macro.

    leelnich: thank you. a quesion: the formula recall cell L4:

    what is value in the cell L4? shouldn't i use only cell K6 and M6 (Q.ty total and remaining q.ty)?

    Maybe i should use =LEFT(REPT("|",M6),M6*M6/K6)

    but what is M6*M6/K6?


    maybe is have to use
    =LEFT(REPT("|",K6),M6) ?
    Last edited by vermaccio; 06-09-2023 at 02:44 AM.

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: remaining quantity bar (related to total quantity)

    Quote Originally Posted by vermaccio View Post
    ...thank you but i would prefer to avoid macro.
    I've been working doubles for a couple of days, just got back on this last night. I see torachan beat me to it, and vermaccio's not interested, but here's my VBA code. This has 2 extra features; the bar responds to changes in EITHER column, and it handles multiple pasted entries.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim MCL As Range, KCL As Range
    
    With Range(Cells(6, "K"), Cells(Rows.Count, "K").End(xlUp))
        Set Target = Intersect(Target, .Offset(0, 2))
    End With
    
    If Not Target Is Nothing Then
    
    For Each MCL In Target
        Set KCL = MCL.Offset(0, -2)
        With MCL.FormatConditions
            .Delete
        With .AddDatabar
            .MinPoint.Modify xlConditionValueNumber, 0
            .MaxPoint.Modify xlConditionValueFormula, "=" & KCL.Address
            .BarFillType = xlDataBarFillSolid
            
            If KCL > 0 Then
                .BarColor.Color = RGB(255, 85, 90)
            End If
            If KCL < MCL Then
                .BarColor.Color = RGB(255, 0, 0)
            End If
        End With
        End With
    Next
    
    End If
    
    End Sub
    Attached Files Attached Files
    Last edited by leelnich; 06-09-2023 at 07:25 AM.

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: remaining quantity bar (related to total quantity)

    Quote Originally Posted by vermaccio View Post
    leelnich:... the formula recall cell L4:

    what is value in the cell L4? shouldn't i use only cell K6 and M6 (Q.ty total and remaining q.ty)?...

    maybe is have to use
    =LEFT(REPT("|",K6),M6) ?
    Not sure what you're referring to. I might have missed some worksheet "cleanup" after de-bugging. Sorry if that caused confusion.

    Referencing THIS formula: =LEFT(REPT("|",23),23*M6/K6) , which appears in L6 and is copied down, by trial and error I found it took 23 pipes to stretch all the way across the cell. You may need to adjust that; use whatever fits. The important part is the ratio defined by M6/K6; it determines how many pipes (out of 23) are displayed.

    I could have written it like this: =REPT("|",23*M6/K6), but that would return too many pipes for the cell if M6 inadvertently exceeds K6, which would alter your row height if you have selected Wrap Text for that cell.
    Last edited by leelnich; 06-09-2023 at 07:15 AM.

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: remaining quantity bar (related to total quantity)

    If you want the representative quantity and the data bar in the same cell - @leelnich has already identified in post#2 that you will need to conditionally format each individual cell - as this involves a calculation with the inputs of columns 'K' & 'M' this would cause a 'circular reference' and fail - you are left with a choice - databar in separate cell or use VBA - unless I am mistaken and someone else knows something that I have missed.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: remaining quantity bar (related to total quantity)

    Another way (in an adjacent cell):

    =I6/G6

    Once you select "show bar only" and OK it, the values vanish and only the bars remain.
    Attached Images Attached Images
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  9. #9
    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. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,369

    Re: remaining quantity bar (related to total quantity)

    I think Lee already suggested that, Glenn (see line #3 of post #2). I think it's the best compromise.

    I have never undersood why MS has failed to make data bars etc. capable of using relative references.
    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.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: remaining quantity bar (related to total quantity)

    So he did... I stopped reading after the =LEFT(REPT("|",23),23*M6/K6) bit.

  11. #11
    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. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,369

    Re: remaining quantity bar (related to total quantity)

    LOL!

    Been there and got the T-shirt ...

  12. #12
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    132

    Re: remaining quantity bar (related to total quantity)

    thank you. problem solved.

  13. #13
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: remaining quantity bar (related to total quantity)

    thanks for the feedback and added rep point - glad to have helped.

+ 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. [SOLVED] Percent complete based off quantity finished and quantity remaining
    By BigPaulMc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2022, 02:29 PM
  2. Google Sheets: remaining quantity formula???
    By denis_galenkov in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 11-14-2020, 07:54 PM
  3. Google Sheets: remaining quantity formula???
    By denis_galenkov in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2020, 06:51 AM
  4. [SOLVED] Remaining quantity calculation
    By Villalobos in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2017, 02:12 PM
  5. [SOLVED] Running total of Quantity on Hand Vs Sales Vs Quantity to Produce
    By jespo1351 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2015, 07:34 AM
  6. Remaining Containers based on Quantity balance
    By thong127 in forum Excel General
    Replies: 3
    Last Post: 02-18-2015, 05:29 PM
  7. Replies: 4
    Last Post: 01-14-2015, 07:46 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