Pivot Table Issues

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
573
Office Version
  1. 365
Platform
  1. Windows
Hello

I have a file that I need to convert to a pivot table to show vender, invoice number and to subtotal based on the invoice number. My issue is on the data file the vender name is not on the same row as the invoices. For example Vender ABC is in cell B15, the invoice numbers start on the row below the vender name and can vary by vender. How can I get the vender name next to each of the invoice numbers below sort of copy and paste them.

For the example I would need the vender name in rows B16 - B64. The invoice numbers are in column K,

The report has many vender names in column B that I need to be copied to rows below the number of rows is different for each vender.

Any help would be appreciated

Thank you
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You can generally get around that using a helper column. Power Query or VBA would also be options you could consider.
If you can show us a sample of your data, including the Row & Column references especially of the vendor no & invoice no columns, we could be more specific
 
Upvote 0
Payables Aging Report
uscb-car
Period: 11/2022
As of : 11/08/2022
PayeePayee NameDoc Seq #ControlBatch IdPropertyInvoice DateDue DatePost MonthAccountInvoice #BaseCurrent0-3031-6061-90OverFutureNotes
CodeCurrencyOwedOwedOwedOwed90Invoice
Owed
ucbstmaSTARLING MADISON LOFQUIST INC0.00
202200003083P-3806179651us011a9/30/202210/31/202211-20225200-4100 Building R&M - Exterior (recoverable)75282usd62.540.0062.540.000.000.0008/19/22 Engineering Services
202200003083P-3806179651us011b9/30/202210/31/202211-20225200-4100 Building R&M - Exterior (recoverable)75282usd92.460.0092.460.000.000.0008/19/22 Engineering Services
202200003083P-3806179651us011c9/30/202210/31/202211-20225200-4100 Building R&M - Exterior (recoverable)75282usd92.460.0092.460.000.000.0008/19/22 Engineering Services
202200003083P-3806179651us011d9/30/202210/31/202211-20225200-4100 Building R&M - Exterior (recoverable)75282usd91.710.0091.710.000.000.0008/19/22 Engineering Services
Total ucbstmausd339.170.00339.170.000.000.00

I am looking to have the vender name copied into the blank cells below. it would need to stop at the lats row with an invoice number. I would need this to work for each vender in the worksheet
 
Upvote 0
If you are mainly using it for a Pivot Table, you can just use formulas out to the right hand side - see below.
Then all you need to do each time you get new data is to make sure the formulas cover all your rows (ie it extends to the last row of your new data)
Then use the additional columns for your pivot.

There is a manual fill down option which is fairly easy to do but you would need to do it each time you refresh the data(it involves using go to > Special > Blank), which means a macro or Power Query would be a better option. Let me know which option you are comfortable with and we can progress that.

20221115 VBA Fill Down Mldeuser.xlsx
ABSTU
1Payables Aging Report
2uscb-car
3Period: 11/2022
4As of : 11/08/2022
5PayeePayee NameNotesPayee CodeName
6Code
7
8ucbstmaSTARLING MADISON LOFQUIST INCucbstmaSTARLING MADISON LOFQUIST INC
908/19/22 Engineering ServicesucbstmaSTARLING MADISON LOFQUIST INC
1008/19/22 Engineering ServicesucbstmaSTARLING MADISON LOFQUIST INC
1108/19/22 Engineering ServicesucbstmaSTARLING MADISON LOFQUIST INC
1208/19/22 Engineering ServicesucbstmaSTARLING MADISON LOFQUIST INC
13Total ucbstmaTotal ucbstmaSTARLING MADISON LOFQUIST INC
14Total ucbstmaSTARLING MADISON LOFQUIST INC
15nextvendorAnother VendornextvendorAnother Vendor
1608/19/22 Engineering ServicesnextvendorAnother Vendor
1708/19/22 Engineering ServicesnextvendorAnother Vendor
1808/19/22 Engineering ServicesnextvendorAnother Vendor
1908/19/22 Engineering ServicesnextvendorAnother Vendor
20Total nextvendorTotal nextvendorAnother Vendor
Aged Payable
Cell Formulas
RangeFormula
T8:U20T8=IF(ISBLANK(A8),T7,A8)
 
Upvote 0
I would prefer a macro to run this as the venders will change each week.

Thank you
 
Upvote 0
See if this does what you need. If it is too slow we will need to switch to using an array.

VBA Code:
Sub FillDown()

    Dim ws As Worksheet
    Dim lastRow As Long, firstRow As Long
    Dim rngSrc As Range, rngBlanks As Range
   
    Application.ScreenUpdating = False
   
    Set ws = ActiveSheet
    lastRow = ws.Range("A" & Rows.Count).End(xlUp).Row
    With Application
        firstRow = .IfError(.Match("Code", ws.Columns("A"), 0), 0)
        If firstRow = 0 Then
            MsgBox "Incorrect Worksheet, 'Code' not found in heading"
            Exit Sub
        End If
    End With
   
    With ws
        If .Range("A" & firstRow + 1) <> "" Then
            firstRow = firstRow + 1
        Else
           firstRow = .Range("A" & firstRow).End(xlDown).Row
        End If
        Set rngSrc = .Range(.Cells(firstRow, "A"), .Cells(lastRow, "A"))
    End With

    ' Fill Down Payee Code
    Set rngBlanks = rngSrc.SpecialCells(xlCellTypeBlanks)
    rngBlanks.FormulaR1C1 = "=R[-1]C"
    rngSrc.Value = rngSrc.Value
   
    ' Fill Down Payee Name
    Set rngSrc = rngSrc.Offset(, 1)
    Set rngBlanks = rngSrc.SpecialCells(xlCellTypeBlanks)
    rngBlanks.FormulaR1C1 = "=R[-1]C"
    rngSrc.Value = rngSrc.Value
   
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

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