+ Reply to Thread
Results 1 to 3 of 3

Dictionary key made up of multiple values/criteria?

  1. #1
    Registered User
    Join Date
    09-29-2014
    Location
    KC
    MS-Off Ver
    2007
    Posts
    20

    Dictionary key made up of multiple values/criteria?

    Can an Excel VBA dictionary key be made up of multiple values?

    If I have 4 columns of data: (A) Number, (B) Job, (C) Date and (D) Hours, can I combine the values of A, B and C to create the key and then return the value of D?

    1000 6666 01/01/1999 1.00
    1000 6666 02/02/1999 2.00
    1000 6666 03/03/1999 3.00


    To retrieve the hours of 1.00, is it possible to combine "1000" and "6666" and "01/01/1999" to make the key?

    To retrieve the hours of 2.00, is it possible to combine "1000" and "6666" and "02/02/1999" to make the key?

    If possible, what would be the syntax ?

    Thanks.

    Bill

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Dictionary key made up of multiple values/criteria?

    Please Login or Register  to view this content.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Dictionary key made up of multiple values/criteria?

    Hi ColdDay,

    Excellent question. What I like to do is to concatenate the values together to make a MASTER KEY value. When doing that I usually add a separator that never appears in any of the values. In your case it could be a space character. I have used dash (-), comma(-), etc. By using a unique separator, I can extract all the values from the key by using the Split() function provided by Excel.

    For example (tested and working):
    Please Login or Register  to view this content.
    Lewis

+ 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. Help using Scripting Dictionary to sum values
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 08-09-2014, 04:15 PM
  2. [SOLVED] How to sum values based on multiple criteria with multple possibilities for each criteria?
    By boredaxel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-05-2013, 02:26 AM
  3. How to compare values with Dictionary
    By PaPaDiZ in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-10-2012, 10:38 AM
  4. Replies: 2
    Last Post: 10-05-2011, 12:43 PM
  5. Add Unique Values to Dictionary
    By mccrimmon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2011, 07:05 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