Results 1 to 5 of 5

Thread: dictionary question
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Apr 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default dictionary question

    Hi, is it possible two have two keys for each value?

    Here's the problem I'm facing with. I have some balance sheets for different people with different dates in different worksheets and files. I want to extract certain data such as the numbers of equity or debt from balance sheet, and rearrange them into a time-series data in a new worksheet.

    I googled some similar tasks and found the dictionary might help me with it. But I checked some dictionary sample code and found most of them are "a key for a value" patterns, which seems not applying to my problem. So I wander whether it's possible to have two keys for each value. Like, key1=date, key2=person name, and value=debt or equity.
    So when I rearrange the data, I could list them like this:
    person A person B person C
    date1 equity1 equity2 equity3
    date2 equity4 equity5 equity6
    date3 equity7 equity8 equity9

    If not, would you mind giving me a hint about how to deal with it? I'd really appreciate it. I just learnt vba for less than two months by myself. So sometimes I kinda fell that I'm lost and don't know where to go.

  2. #2
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,154
    Post Thanks / Like
    Mentioned
    62 Post(s)
    Tagged
    6 Thread(s)

    Default Re: dictionary question

    Why not use a 'composite' key by combining the data and the name?
    Last edited by Norie; May 7th, 2019 at 05:22 AM.
    If posting code please use code tags.

  3. #3
    New Member
    Join Date
    Apr 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: dictionary question

    Thanks for your advice But I'm still a little confused.
    Do you mean combine the name and date with some punctuatuion between them, and use split to process the key when making a time series table?

  4. #4
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,154
    Post Thanks / Like
    Mentioned
    62 Post(s)
    Tagged
    6 Thread(s)

    Default Re: dictionary question

    Yes, that's basically what I mean.
    If posting code please use code tags.

  5. #5
    Board Regular Kyle123's Avatar
    Join Date
    Jan 2012
    Location
    Leeds, UK
    Posts
    2,641
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    2 Thread(s)

    Default Re: dictionary question

    Or nested dictionaries, a top level with unique dates and then one with names (or vice versa)

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •