+ Reply to Thread
Results 1 to 6 of 6

Get data from specific columns with multiple conditions

  1. #1
    Registered User
    Join Date
    06-11-2020
    Location
    London, England
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    2

    Get data from specific columns with multiple conditions

    Hi

    What I need to do is retrieve the £ sales according to the average lead time bracket (<1 week is express, 1-4 weeks and 4+ Weeks), by week and product type.
    It seems like it should be easy enough to do but I can't seem to figure it out and was hoping someone may be able to help.

    I've attached an example of the data I'm working with and an example of the rollup sheet.

    Thank you in advance!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Get data from specific columns with multiple conditions

    Hi -

    You can use SUMPRODUCT with the OFFSET function to accumulate your values based on the criteria: Apple, Week, and LT Bracket. The following formula is in Cell C6 of your example:

    =SUMPRODUCT((Data!$A$3:$A$14=Rollup!$A$1)*(OFFSET(Data!$D$3,0,MATCH(Rollup!C$5,Data!$D$1:$DC$1,0)-1,12)<1)*(OFFSET(Data!$D$3,0,MATCH(Rollup!C$5,Data!$D$1:$DC$1,0),12)))

    The first term in SUMPRODUCT, in green, checks to see if the each row matches "Apple". Next, the first OFFSET function, in red, returns a range of cells, 12 cells high, and located however many cells over from D3 that the MATCH function counts based on the week number. So, for example, Week 1 is the very first entry, so Match returns 1 (then I have to subtract 1 to make it 0 for my OFFSET). Likewise Week 2 returns a 2, and so forth. This gives me the column with the LT's for that week, then I compare that to <1 for express, between 1 and 4 and then >=4 as you go down in cells C7 and C8. Finally, the second OFFSET function,in Blue is the corresponding list of values.

    Attached is your spreadsheet with the above formulas implemented. You can play around with the Week headings or type in Banana in A1 and you can see the values change.

    Hope this helps.
    Attached Files Attached Files
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Get data from specific columns with multiple conditions

    there are a few options here, tbh (incl a Pivot) but...below is a non-volatile SUMIFS approach

    type following into A6:A8:

    < 1
    <= 4
    < 1000
    these will act as criteria for week test in SUMIFS

    with the above in place -- you could use something like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    note: I've assumed you could change Week number in the header, e.g. if you changed C5 to "W21" the results would auto adjust.

  4. #4
    Registered User
    Join Date
    06-11-2020
    Location
    London, England
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    2

    Re: Get data from specific columns with multiple conditions

    Hello,

    This has worked perfectly, and your explanation has really helped me understand the process.
    Thanks so much for your help!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,031

    Re: Get data from specific columns with multiple conditions

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Get data from specific columns with multiple conditions

    Thanks for the Rep CC!

+ 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. [SOLVED] Sum Across Specified Columns with Specific Conditions
    By Darko_Giac in forum Excel General
    Replies: 3
    Last Post: 01-15-2019, 03:44 PM
  2. Replies: 29
    Last Post: 01-01-2017, 10:25 AM
  3. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  4. [SOLVED] Macro for data present in multiple rows and columns following multiple conditions
    By macrolearnerkk in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-07-2015, 11:20 AM
  5. [SOLVED] macro needed to extract specific columns out of multiple columns with their row data
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-07-2014, 12:49 AM
  6. Extract Data based on conditions on multiple columns
    By checkoncomp in forum Excel General
    Replies: 6
    Last Post: 07-03-2013, 01:54 PM
  7. Replies: 2
    Last Post: 04-04-2013, 12:26 PM

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