Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6659863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:04:59+00:00 2026-05-26T02:04:59+00:00

So I have this Excel workbook which basically is supposed to be a data

  • 0

So I have this Excel workbook which basically is supposed to be a data sheet for work clothes for each employee. What I want is to have one sheet for each person (first name and last name), then one sheet for each clothing available.

Then one sheet to merge it all together. But, this would involve a repeat of each name as many times as there are unique cloth types. Hard to explain, but I’ve got a workbook available for download here:
http://www.mediafire.com/?dxurbdjq340su6j

Sheet2(Users) contains a simple list of each unique user. Sheet3(Articles) contains a list of each unique clothing article. And then finally we have the first Sheet(Summary) which contains a merged list of it all. Based on this Summary sheet, I’m gonna create a pivot table later. But first I need the functionality here to be dynamic. Whenever a new user or clothing is added or deleted, I only want to do this in Sheet2 or Sheet3. Whatever is in Sheet1 should collect the data dynamically.

Any idea? Would I have to create a macro to do this?

Edit: Ok, so I’ve created a module with two public Dictionaries. Here’s the code I’ve got so far:

ThisWorkbook

Private Sub Workbook_Open()
    ' Create dictionaries
    Set dictName = New Dictionary
    Set dictClothItems = New Dictionary

    ' Collect data
    collectDictName
    collectDictClothItems
End Sub

Module1:

Public dictName As Dictionary
Public dictClothItems As Dictionary

Public Sub collectDictName()
Dim v As Variant
Dim rngName As Range

    ' Add values

    With ThisWorkbook.Sheets(2)
        Set rngName = .Range("A2", .Range("A" & Rows.Count).End(xlUp))

        For Each strName In rngName
            dictName.Add strName, ""
        Next
    End With
End Sub

Public Sub collectDictClothItems()
Dim v As Variant
Dim rngName As Range

    ' Add values

    With ThisWorkbook.Sheets(3)
        Set rngName = .Range("A2", .Range("A" & Rows.Count).End(xlUp))

        For Each strClothName In rngName
            dictClothItems.Add strClothName, ""
        Next
    End With
End Sub

So, here I collect the data and store these in an array. I wasn’t sure how to collect the data from the range, so I used For Each strName In rngName. Looks like it collects other data that I really don’t need as well. Can probably fix that up by creating a string variable and assigning the value I’m after to that. And then adding that string to the Dictionary. Anyways, now that the data’s collected, I need to compare and add it to the actual Summary sheet now. Any idea on where to begin?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:05:00+00:00Added an answer on May 26, 2026 at 2:05 am

    Question rephrasing

    So basically, what you want is:

    Each time you add a new value on either Sheet2 (Users) or Sheet3 (Clothes), you want Excel to dynamically add on Sheet1 (Summary) a new row for each value on the other Sheet (Users or Clothes depending on the one that was changed)

    Btw, where does the amount come from?

    Answer

    Yet, to answer your question, the easiest way is to do it with VBA so it will be dynamic.

    Here is what you can do:

    • add en event Worksheet_Change() on both Sheet2 and Sheet3 (see on Chip Pearson website how to do it)
    • this procedure will watch every change on these sheets. Every time a user add a value, you should loop over the other Sheet get the value from the other sheet and populate an array (Clothes or User depending on the value)
    • IMHO, the easiest way to consolidate the data is to create loop over your created array (or use a dictionary) and append every new row to your array
    • eventually, you can add the array in your Summary sheet

    Don’t hesitate to ask for some more information if you need or ask a new question with what you’ve tried if you are still stuck.


    [EDIT 2] Here is a full working solution for articles (easily adaptable for users)

    Code on Sheet3 (Articles)

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim aSum() As String
    Dim sArticle As String, sPrice As Long
    Dim i As Integer, iLastrow As Integer
    
    If Intersect(Range("A:B"), Target) Is Nothing Then Exit Sub
    'if no price, exit sub
    If Not Intersect(Range("A:A"), Target) Is Nothing Then
        If Target.Offset(0, 1).Value = Empty Then Exit Sub
        sArticle = Target.Value
        sPrice = CLng(Target.Offset(0, 1).Value)
    End If
    'if no name, exit sub
    If Not Intersect(Range("B:B"), Target) Is Nothing Then
        If Target.Offset(0, -1).Value = Empty Then Exit Sub
        sArticle = Target.Offset(0, -1).Value
        sPrice = CLng(Target.Value)
    End If
    
    'get the names in an array        
    collectNames
    'store the data in a new array so to map these values in the end
    ReDim aSum(UBound(vNames) - 1, 3)
    For i = 0 To UBound(vNames) - 1
        aSum(i, 0) = vNames(i + 1, 1)
        aSum(i, 1) = sArticle
        aSum(i, 3) = sPrice
    Next
    
    'store the data back to the Summary sheet
    With ThisWorkbook.Sheets("Summary")
        iLastrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
        .Range("A" & iLastrow & ":D" & iLastrow + UBound(vNames) - 1).Value = aSum
    End With
    End Sub
    

    Code in a module

    Option Explicit
    
    Public vNames As Variant
    Public vClothes As Variant
    
    Public Sub collectNames()
    With ThisWorkbook.Sheets(2)
        vNames = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
    End With
    End Sub
    
    Public Sub collectClothItems()
    With ThisWorkbook.Sheets(3)
        vClothes = .Range("A2", .Range("B" & Rows.Count).End(xlUp))
    End With
    End Sub
    

    I didn’t use dictionaries (maybe @Issun may have an idea here, he is a dict-expert) but arrays because it was easier to map to the sheet ranges.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have published my Excel workbook (which is one sheet with pivot-data linked to
I have the this code that will create excel file and work sheet then
I have an Excel workbook with a number of features: One main user-facing sheet
I have an Excel Spreadsheet like this id | data for id | more
I have a VBA publishing macro in Excel which generates a published workbook based
So I've got this Workbook which contains a lot of data. And I've got
I have an Excel 2007 workbook which I am using to connect to a
We have an Excel workbook which has c# VSTO code in it and two
I have a Vsto Excel workbook (created in Visual Studio) which also contains a
I have a Vsto Excel workbook (created in Visual Studio) which also contains a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.