subtotaling text question

tralalah

New Member
Joined
Jan 19, 2005
Messages
36
I've got a quick question. I am subtotaling an order qty report by items

Column a is the item numbers
column b is the order qty
column c is the product group- this is a text field
column d is the sub-product group- this is a text field

When I do the subtotal only 0 shows up for the product and sub-product. How can I subtotal and have those text fields show up on the total line?

Thanks for any light you can shed.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Consider using a PivotTable to summarize your data. Column A, C & D to the Row Area and B to the Data Area - ensure the aggregation is Sum.
 
Upvote 0
Thanks but a pivot table is not really what I am looking for. I think the data range is too big for a pivot table it would be like 1000 lines long. I just simply want a way for the text to show up when the item is grouped instead of a 0.
 
Upvote 0
Try this code. It will work most quickly if only the subtotal rows are visible.

Code:
Sub InsertSubtotalTextValues()

    'This code will copy the value of the cell (or insert a formula pointing at the cell)
    'above a blank cell into the blank cell
    
    Dim rngUsed As Range
    Dim rngCell As Range
    
    Set rngUsed = Range(Cells(2, 1), Cells(ActiveCell.SpecialCells(xlLastCell).Row, 4))
    rngUsed.Select
    Set rngUsed = Selection.SpecialCells(xlCellTypeVisible)
    
    For Each rngCell In rngUsed
        'If rngCell = "" Then rngCell.FormulaR1C1 = "=R[-1]C"   'will put in a formula
        If rngCell = "" Then rngCell = rngCell.Offset(-1, 0)   'will put in a value
    Next
    
    Set rngCell = Nothing
    Set rngUsed = Nothing
End Sub
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top