+ Reply to Thread
Results 1 to 18 of 18

What is the formula to get data for selected items from a large database

  1. #1
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    What is the formula to get data for selected items from a large database

    Summary report for the following data:

    15 Depots, 3 business units and about 900,000 rows of data for costs

    On a separate sheet, I want to be able to look at total cost of each cost category by Depot and by Business Unit

    I can do a pivot report. But want to see a summary where the user can choose the depot by way of checkbox and the costs, only for the depot or depots checked, for each cost category are shown by business unit. I wonder what formula will work here?


    Depot Business Unit Cost 1 Cost 2 Cost 3
    AAA 111
    112
    113
    BBB 111
    112
    113


    File attached (Excel 365)
    Last edited by Patthar; 11-15-2019 at 12:13 AM.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: Formula for data for selected criteria

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Dave

  3. #3
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: Formula for data for selected criteria

    Thanks - how do I edit the title?

  4. #4
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: Formula for data for selected criteria

    Done. Thanks

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: What is the formula to get data for selected items from a large database

    Please try in J12 filled down and across to L17.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Thanks very much.

    Is there any way the user can select depot / depots which are listed in Column A, by way of a tick in a tick-box, and the result is summarised in Column G, for each Depot ticked or the number of depots ticked.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: What is the formula to get data for selected items from a large database

    You will need to upload a sample file that is an exact example of what you are attempting to describe. What you have uploaded shows the user has already selected 'Depots' in column H. Selecting by "tick boxes" makes no sense. The 'Depots' are already selected.

    Would the use of in-cell drop downs in column H (and possibly I?) be of any use? See those in the attached along with the formula proposed in post #5 above.

  8. #8
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Thanks.

    I have attached the file.


    = In Cell S9, total of cost 1 from from column D for the depot and business unit ticked in column J and column n
    = In Cell S10 total of cost 2 from from column D for the depot and business unit ticked in column J and column n
    = In cell S11, total of cost 3 from from column D for the depot and business unit ticked in column J and column n

    If more than one depots are ticked, need the total of all the depots ticked

    Hopefully, I have explained well.
    Attached Files Attached Files

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: What is the formula to get data for selected items from a large database

    In the attached I put random values. Otherwise all results would be 0.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Thanks.

    Something is not right.

    When I tick AAA in column J, and tick Business Unit 111 in column N, the total for cost 1 in cell S9 is 116, which is not correct - it should be 47. also the amounts in cell S10 and S11 are not correct

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,801

    Re: What is the formula to get data for selected items from a large database

    Try this three formula* modification of Dave's formula:
    For S9: =SUMPRODUCT((D5:D44)*ISNUMBER(MATCH($B$5:$B$44,IF($K$9:$K$23,$I$9:$I$23),0)*MATCH($C$5:$C$44,IF($O$9:$O$11,$M$9:$M$11),0)))
    For S10: =SUMPRODUCT((E5:E44)*ISNUMBER(MATCH($B$5:$B$44,IF($K$9:$K$23,$I$9:$I$23),0)*MATCH($C$5:$C$44,IF($O$9:$O$11,$M$9:$M$11),0)))
    For S11: =SUMPRODUCT((F5:F44)*ISNUMBER(MATCH($B$5:$B$44,IF($K$9:$K$23,$I$9:$I$23),0)*MATCH($C$5:$C$44,IF($O$9:$O$11,$M$9:$M$11),0)))
    *Denotes array entered formulas which are confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.
    Note that you will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: What is the formula to get data for selected items from a large database

    Yep my formula was incorrect. I haven't tried JeteMc's yet. I reworked mine. In S9:S11 try this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I don't think it will require Ctrl + Shift + Enter. If it returns errors or incorrect answers then try CSE. It didn't at my end, but I have recently joined the 'Insider' group. Lately things have behaved differently in unexpected ways.

    Late Edit: Now that I've looked the only difference between JeteMc's and mine is the dynamic column D:F selection.
    Last edited by FlameRetired; 11-22-2019 at 01:33 PM.

  13. #13
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Thanks for your help.

    Both formulae do not work, yet

    In column J, I have selected Depots AAA and BBB and in column N, I have selected Business Unit 111. The answer in column S, shows total only for Depot AAA and not for both AAA and BBB.

    I have attached the file with formula from Jetemc,

    I have also tried Flameretired’s formula. It gives the same result as Jetemc’s formula, when entered as an “Array” formula – does not work without an array formula.
    Attached Files Attached Files

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,801

    Re: What is the formula to get data for selected items from a large database

    There are no records where Depot BBB is in the same row as Business unit 111.
    When AAA, BBB and 111 are selected Dave's array entered formula (used in file attached to post #13) yields 47, 21 and 48 which are correct.
    Check by filtering file.
    Let us know if you have any questions.

  15. #15
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: What is the formula to get data for selected items from a large database

    If you don't mind to use a helper column.

    Please try this , at helper column G5
    Please Login or Register  to view this content.
    Then copy down until the end of data.

    And
    S9
    Please Login or Register  to view this content.
    S10
    Please Login or Register  to view this content.
    S11
    Please Login or Register  to view this content.
    Regards.

  16. #16
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Apologies for the oversight - all working well. Thanks for your help - appreciate it.

  17. #17
    Registered User
    Join Date
    05-21-2018
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    15

    Re: What is the formula to get data for selected items from a large database

    Quote Originally Posted by menem View Post
    If you don't mind to use a helper column.

    Please try this , at helper column G5
    Please Login or Register  to view this content.
    Then copy down until the end of data.

    And
    S9
    Please Login or Register  to view this content.
    S10
    Please Login or Register  to view this content.
    S11
    Please Login or Register  to view this content.
    Regards.

    Thanks - but the formulae provided by Flameretired and Jetemc is working.

  18. #18
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,801

    Re: What is the formula to get data for selected items from a large database

    Re: Post #16. You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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. Macro - Copying and Pasting selected slides (based on selected keywords/criteria i
    By erickhawe in forum PowerPoint Formatting & General
    Replies: 2
    Last Post: 03-28-2021, 01:02 PM
  2. [SOLVED] Copy selected data to multiple worksheets when certain criteria in a row is met
    By ejecheche in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-07-2019, 08:28 AM
  3. [SOLVED] Data Retrival from selected RANGE with Multiple criteria
    By onp in forum Excel General
    Replies: 11
    Last Post: 04-02-2019, 07:37 AM
  4. Copy filtered Data into another worksheet based on selected criteria
    By TheresaHartigan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2014, 09:39 AM
  5. [SOLVED] Need VBA or formula that will copy selected rows based on criteria to a new sheet
    By cljohnston64 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2013, 11:43 AM
  6. [SOLVED] Automatically input data into cell D1 whenever criteria selected
    By chisox721 in forum Excel General
    Replies: 9
    Last Post: 08-23-2013, 07:55 AM
  7. Replies: 2
    Last Post: 06-28-2012, 03:15 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