+ Reply to Thread
Results 1 to 17 of 17

Excel 2007 : Index with Duplicates

Hybrid View

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Index with Duplicates

    Hey all,

    I am trying to create an announcements workbook for HR. sheet 1 "Raw Announcements" consists of multiple drop down menus in A that will allow the person in hr to select which department the announcement is for. B allows for them to fill in the announcement. I used an index with a match to create individual sheets for each department (such as "Claims" in the example below) that will then be linked to power points saved in each department's folder allowing us to automate the announcement process with a quick "refresh links" every month done by HR before department staff meetings.

    The issue I'm coming across is ( and I knew I'd run into this I just can't figure it out) since the department names are not distinct in situations where there are multiple announcements for any given department, the function simply repeats the same announcement.

    ex: Raw Announcements sheet A1 "claims" b1 "everyone is fired" A2 "claims" b2 "nevermind"
    Claims sheet A1 "claims" B1 "everyone is fired" A2 "claims" B2 "everyone is fired.

    Currently I am working with:
    =IFERROR(CONCATENATE("- ",INDEX('Raw Announcements'!$A$3:$B$100,MATCH(Claims!$A3,'Raw Announcements'!$A$3:$A$100,0),2))," ")

    I know if i make entries in A distinct it becomes a no-brainer, but that would destroy the functionality of the drop down menu. Secondly I could create a subset of drop down menus that are distinct and have them =Indirect(...) to the first drop down, but it all seems so ugly.

    any other ideas on a workaround?

    Thanks!

    Ker

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Make sure the workbook demonstrates your desired results if possible, or just highlight the cells you're trying to fix. Use BEFORE/AFTER sheets if that helps make it clearer.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    dummy updates.xlsx

    this is a dummy version of what I'm working on, does this help?

    the goal is to be able to change the drop down menu located in raw announcements and have it auto populate into that department's tab without the fields in the A columns of either sheets needing to be distinct.
    Attached Files Attached Files
    Last edited by kerui; 06-07-2012 at 03:22 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    Have a look... a change on the "master" sheet so you can just enter any department on any and flag it as a "manager" message.

    Each department sheet is now identical. You can create a new department sheet by simply copying one of the existing sheets and renaming the sheet. It's the name of the sheet that triggers the value in A1 causing those items to be collected.

    The array formulas on the sheets do the heavy lifting.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    Thanks so much this is perfect!

  6. #6
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    I am trying to duplicate this work for another project and I am having trouble following the logic, could someone go into detail regarding the array formula he used?


    Thanks!

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    =IFERROR(INDEX('Raw Announcements'!$C$1:$C$100, SMALL(IF(INDEX('Raw Announcements'!$A$1:$A$100&'Raw Announcements'!$B$1:$B$100=$A$1, 0), ROW('Raw Announcements'!$C$1:$C$100), ""), ROW(A1))), "")


    The INDEX is making a single reference list of the values in A1:A100 & B1:B100 on the Raw sheet. So in the example sheet, since A3=Claims and B3=Manager, that creates a string ClaimsManager. A4=Claims and B4=(blank) so the string created is just Claims. And so on. The array strings those 100 pairs of cells together.

    The IF() function that is wrapped around the index above tests each of those strings created above to see if the string created matches the value in cell A1 on that sheet. So on the Claims sheet, it would make a match on rows 4, 12, and 14-100, all are just "claims", so they would all endup in the array. {4,12,14,15,16,17,etc....}

    The SMALL() function that is wrapped around that is used to grab one value at a time out of that array. SMALL(array, k). For "k" we start with ROW(A1) which translates to 1, so SMALL takes the first value in the array, in this case 4.

    The final step is the outer INDEX() function. We made an index of the entire column C on the Raw sheet, now we want the value in the "row" that matches the value the SMALL() returned. The first value it found was 4 (row 4), so it returns the 4th value in column C... which is the message "Never Mind". So that is the FIRST result you get in B3 with that initial formula.

    Now, when B3 is copied DOWN to B4, all the parts of the formula stay the same except the final ROW(A1) changes to ROW(A2). Row(A2) translates to 2, so now the SMALL() array will spit out the second smallest number, in this case 12. The 12th value in column C of RAW is "Message10".

    Now you see how it works.
    ============================

    The second section of array formulas starts again at B11 on the Claims sheet and the formula is almost identical, except we add the word "Manager" to the value in A1 to create "ClaimsManager", and the inner INDEX is now creating an array of rows that resolve to that instead of just "Claims". Other than that, all is the same.

  8. #8
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    Adherence_Automation_File_6.18.12.xls

    That's the file I am working with now,

    i tried to use a similar array formula to pull the info in but obviously I am missing something because I cant get it to perform properly.

    I'd love help but would also love some explanation so I don't have to come back to you guys next time.


    Thanks so much guys

    Ker

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    can't seem to find your non-working formula anywhere. I need to see your edits to see where it is breaking.

    Also, Array formulas are confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will see enclosing braces { } appear around your formula to indicate an active array. Maybe that's all you missed.

  10. #10
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    I cant seem to get it to work. Ive attached my worksheet again with the attempted formula. Adherence_Automation_File_6.18.12.xls

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    Here's an example where a row# added to the column A makes it so only one array formula is needed on each row of the named sheet(s).
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    Thanks so much, I thought I had an error but I figured it out, silly program forgot a space in someone's name.

    You are a lifesaver.
    Last edited by kerui; 06-19-2012 at 01:40 PM.

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    This is formula:

    =IFERROR(INDEX('MS Agents wk'!A$1:A$300, SMALL(IF('MS Agents wk'!$B$1:$B$300=$A$1, ROW('MS Agents wk'!$B$1:$B$300), ""), ROW($A1))), "")

    ...notice there are no braces? Excel adds those when you press CTRL-SHIFT-ENTER as you enter the formula above in cell A3. Then you copy across and down 20-30 rows, no more than needed.

    Also, I noticed you changed the formula from evaluating 100 rows to evaluting an entire column... 65k rows! Never do that with an array. Decide how many rows you're going to need, add a buffer, and use that.

    After enter the formulas, of course, we had to fix the formatting of the data appearing on the Green, Al sheet, and I also went into to FILE > OPTIONS > ADVANCED (scroll down a bit) and UNcheck the [x] Zero Values option. (Maybe Tools > Options > View on Excel 2003).

    Once you've made those changes and then copied the first row formulas down 20-30 rows, copy that sheet and rename the copies to make sheets for other people.

    Array formulas are calc-intense, so try to keep the number of cells holding them down to only a required number. If you're going to be adding TONs of data on the main sheet, then we might want to also eliminate a good chunk of these array formulas on the names sheets. We could do that easily if there were a single column on your data sheet that had a unique value on every row. If you inserted an empty column A and just added a row # to number each row uniquely, we could change the name sheets to only having an array formula in one column, then all the rest of the formulas could be VLOOKUP and the workbook would stay very robust.

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

  15. #15
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    I know this post is old and you have helped me a lot, but I have one more question.

    I am back to working with Department Updates and Announcements.xlsx again and I was wondering if it is possible to eliminate the "all" tab and incorporate the updates flagged as all into every department sheet so that whether flagged as "claims" or "All" it still populates on the claims sheet? maintaining the same functionality of the manager announcements as well of course.


    Thanks again!

    PS I promise to flag this thread as solved after this haha!

  16. #16
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index with Duplicates

    Array for B3:

    =IFERROR(INDEX('Raw Announcements'!$C$1:$C$10, SMALL(IF(INDEX('Raw Announcements'!$A$1:$A$10&'Raw Announcements'!$B$1:$B$10=$A$1, 0) + INDEX('Raw Announcements'!$A$1:$A$10&'Raw Announcements'!$B$1:$B$10="All", 0), ROW('Raw Announcements'!$C$1:$C$10), ""), ROW(A1))), "")

    Array for B11:

    =IFERROR(INDEX('Raw Announcements'!$C$1:$C$10, SMALL(IF(INDEX('Raw Announcements'!$A$1:$A$10&'Raw Announcements'!$B$1:$B$10=$A$1&"Manager", 0) + INDEX('Raw Announcements'!$A$1:$A$10&'Raw Announcements'!$B$1:$B$10="AllManager", 0), ROW('Raw Announcements'!$C$1:$C$10), ""), ROW(A1))), "")


    Copy down, the copy to other sheets, then delete the ALL sheet.

  17. #17
    Registered User
    Join Date
    06-07-2012
    Location
    Richmond, Va
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Index with Duplicates

    Thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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