0

I am trying to make a dynamic array featuring a selective Top (whatever…5, 10, 12, etc) Report. Using Index/Sort/Unique/Sequence I am able to get close, but can’t figure out how to SUM the results so that multiple occurrences of an account are grouped into a single quantity total.

I have a table, EXAMPLE1, with six columns (DEALER, ORDER NO, ACCOUNT NAME, YEAR, MONTH, QTY). I’m trying to get my dynamic array, based on four criteria fields (DEALER – Cell I1, YEAR – Cell I2, MONTH – Cell I3, and number of rows for results – Cell I4), to display the results sorted by quantity in descending order, with the quantities totaled by account. Using the formula (which I guess I'm sort of stuck on)

=INDEX(SORT(UNIQUE(FILTER(EXAMPLE1,(EXAMPLE1[DEALER]=$I$1)*(EXAMPLE1[YEAR]=$I$2)*(EXAMPLE1[MONTH]=$I$3),EXAMPLE1)),6,-1),SEQUENCE($I$4),{3,6})

I am able to get the quantity by occurrence and sorted by quantity for the number of rows I want displayed, but some accounts are duplicated if they occur two or more times on the EXAMPLE1 table. So I get

Bob's Boats 74
Marlin Sails Inc    71
Bob's Boats 42
Mike's Lemonade Stand   40
Labyrinth Walkways LLC  32
Direct Mailings LLC 16
Marlin Sails Inc    14

Instead of

Bob's Boats 116
Marlin Sails Inc    85
Mike's Lemonade Stand   40
Labyrinth Walkways LLC  32
Direct Mailings LLC 16

I used alternative formulae,

=SORT(UNIQUE(FILTER(EXAMPLE1[ACCOUNT NAME],(EXAMPLE1[DEALER]=I1)*(EXAMPLE1[YEAR]=I2)*(EXAMPLE1[MONTH]=I3))))

for the account cell, and

=SUMIFS(EXAMPLE1[QTY],EXAMPLE1[DEALER],I1,EXAMPLE1[YEAR],I2,EXAMPLE1[MONTH],I3,EXAMPLE1[ACCOUNT NAME],K16#)

for the quantity cell, which grouped the accounts by quantity totals, but cannot get that array to sort by quantity or provide results based on a desired number of rows.

Bob's Boats 116
Direct Mailings LLC 16
Labyrinth Walkways LLC  32
Marlin Sails Inc    85
Mike's Lemonade Stand   40

1 Answer 1

0

Perhaps try:

=TAKE(
    SORT(
        UNIQUE(
            HSTACK(
                EXAMPLE1[ACCOUNT NAME],
                SUMIFS(
                    EXAMPLE1[QTY],
                    EXAMPLE1[DEALER], I1,
                    EXAMPLE1[YEAR], I2,
                    EXAMPLE1[MONTH], I3,
                    EXAMPLE1[ACCOUNT NAME], EXAMPLE1[ACCOUNT NAME]
                )
            )
        ),2,-1
    ),I4
)
Sign up to request clarification or add additional context in comments.

1 Comment

This works great, summing the account totals and grouping them and sorting them by quantity. However, after compiling the account totals that satisfy the criteria, the formula fills out the rest of the rows with the other account names with quantity totals of 0, regardless of the dealer. So with a desired row count of 10, the results look like the below:Bob's Boats 116 Marlin Sails Inc 85 Mike's Lemonade Stand 40 Labyrinth Walkways LLC 32 Direct Mailings LLC 16 Alliance Inc 0 Remote LLC 0 Mom and Pop Inc 0 Truth Inc 0 Rugby LLC 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.