+ Reply to Thread
Results 1 to 7 of 7

Index Match to lookup from multiple sheet with condition in row and column

  1. #1
    Registered User
    Join Date
    11-24-2020
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    4

    Index Match to lookup from multiple sheet with condition in row and column

    Hi

    I need a formula to get the sum results from multiple sheets with row & column criterial.

    I have tried using Index & match with Indirect, but cannot work.

    How to add the index array from multiple sheets? and the Match for Rows and Columns from multiple sheets?

    I can do the index & match if from single sheets but not from multiple sheet.

    Please have a look from my attached sample.

    Appreciate your help on this.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,968

    Re: Index Match to lookup from multiple sheet with condition in row and column

    Hi Try this out:

    =SUMPRODUCT(SUMIFS(OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,),INDIRECT("'"&$G$1:$G$4&"'!A2:A20"),$A13,INDIRECT("'"&$G$1:$G$4&"'!B2:B20"),IF($A$10="All","*",$A$10)))

    Adjust the end of the range as needed... but do not go mad and add 100,0000 rows if you have 200. Otherwise it'll get slow.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    11-24-2020
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    4

    Cool Re: Index Match to lookup from multiple sheet with condition in row and column

    Hi Glenn

    Wow..wow.. wow.. Imaging... With such a short formula it provide multiple results that I need. Thank you so much for making my day.


    I have done a modification to add an IF function at the end of your formula to get the result with criterial for "MAIN", which is to SUM for those empty cell at Column B in each region sheets.

    =SUMPRODUCT(SUMIFS(OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,),INDIRECT("'"&$G$1:$G$4&"'!A2:A20"),
    $A13,INDIRECT("'"&$G$1:$G$4&"'!B2:B20"),IF($A$10="All","*",IF($A$10="MAIN","",$A$10))))

    and apply the same formula to work on the 2nd table below for each outlets by selected month. It work perfectly.


    I few questions from your formula as below:

    (1) When I try to tally back the total for ALL outlets including "Main", your formula ... IF($A$10="A11","*".... does not include the "Main"-empty cell.

    What "Wildcard character" should I put that also include empty cell for ALL?

    I have done the below formula without using wildcard and it work well too. But I guess my formula may slowdown the calculation process as I have long list around 6000 rows in each source worksheets and for about 20 sources worksheets and 10 calculation sheets in a file. So I still prefer your short formula to reduce the calculation process.

    =IF($A$10="ALL",SUMPRODUCT(SUMIF(INDIRECT("'"&$G$1:$G$4&"'!A2:A20"),$A13,OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,))),
    SUMPRODUCT(SUMIFS(OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,),INDIRECT("'"&$G$1:$G$4&"'!A2:A20"),$A13,
    INDIRECT("'"&$G$1:$G$4&"'!B2:B20"),IF($A$10="MAIN","",$A$10))))



    (2) The monthly columns format will changed to dd/mm/yyyy (eg: 31/01/2019, 28/02/2019,.... 31/01/2020, 28/02/2020... instate of MMM (eg: JAN, FEB, MAR...) as there will be more columns for months in difference years and also in between the months columns there will have yearly total.


    If using OFFSET function =OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,) it lookup the column by counting the number of column, which will be included the yearly total column. Is there any other better function can be use to match or lookup the column header?


    After all the above tested, I found that I don't need to press CTRL+SHIFT+ENTER even with Sumproduct function in the formula. Just Enter it still provide the results correctly.


    Looking forward for your solution.

    Once again, I would like to thank you so much for your reply to my request.


    Shirlena
    Last edited by Shirlena; 12-01-2020 at 02:09 AM.

  4. #4
    Registered User
    Join Date
    11-24-2020
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    4

    Re: Index Match to lookup from multiple sheet with condition in row and column

    Hi Glenn,

    Guess I have found the solution for my own question #2 above by replacing the column in the Offset function using Match as below:

    OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MATCH($A$20,'1R1'!$C$1:$P$1,0)-1,,)



    I still cannot get the replacement character for wildcard "*" for the "ALL" including blank cells for below your formula.

    =SUMPRODUCT(SUMIFS(OFFSET(INDIRECT("'"&$G$1:$G$4&"'!C2:C20"),,MONTH(B$12&1)-1,,),INDIRECT("'"&$G$1:$G$4&"'!A2:A20"),
    $A13,INDIRECT("'"&$G$1:$G$4&"'!B2:B20"),IF($A$10="All","*",IF($A$10="MAIN","",$A$10))))

    Maybe you can advice.

    Thanks.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,968

    Re: Index Match to lookup from multiple sheet with condition in row and column

    There's nothing absolutely special about MAIN that will slow things down... I think. I have taken one tiny step out of the formula in B23, copied across and down. I have also added a formula in Row 21 (shaded orange).

    I cannpt comment about Q2,as you have added on new columns, I think, which are not on your posted sheet.

    Do the IR sheets have to be separate? Can they not all be combined into one, at data import? That would simplify everything!!

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,968

    Re: Index Match to lookup from multiple sheet with condition in row and column

    It would help if I added the sheet...

  7. #7
    Registered User
    Join Date
    11-24-2020
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    4

    [SOLVED] Index Match to lookup from multiple sheet with condition in row and column

    Hi Glenn

    "MAIN" is consider one of the outlet just it don't come with any prefix code like other outlets at Column B in the individual sheet.
    Somehow I still need to put it in the calculation.

    Yes it is more simplify if all under one sheet but too bad the source are from separate system database which I cannot combine or edit it.

    I have applied all the formula as discussed above into my original financial analysis file and they are working find. Just it will take about 30sec to run the calculation process whenever the selection is changed. However it is fine as long as the results turn out correctly.

    I have seen your replied to many requestors and helping them to solve their questions. I am so blissful that I am one of them. You are just imaging and wonderful.

    Thanks again Glenn on solving my questions.
    Last edited by Shirlena; 12-01-2020 at 09:04 PM.

+ 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] Index Match List Lookup - Multiple same values with condition
    By UHD in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-25-2019, 09:43 AM
  2. Replies: 3
    Last Post: 01-20-2018, 01:28 AM
  3. Using Index/Match (or other lookup),with an if condition to find data
    By kzaveri19 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-10-2017, 04:38 PM
  4. Multiple Condition Index match to find max row value
    By Sc0tt1e in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-26-2016, 12:50 PM
  5. Replies: 7
    Last Post: 07-26-2015, 04:02 PM
  6. Multiple column lookup using index match
    By adaws in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-22-2013, 11:43 PM
  7. Multiple condition lookup for Index function
    By cheal2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-17-2013, 09:13 AM

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