+ Reply to Thread
Results 1 to 15 of 15

MIN IF function across multiple worksheets

  1. #1
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    MIN IF function across multiple worksheets

    Hi forum,

    I currently use a formula that counts the number of times an item appears across multiple worksheets. It looks like this:

    =SUMPRODUCT(COUNTIF(INDIRECT("'"&A1:A10&"'!B1:B100"),C1))

    Where:

    A1:A10 contains the list of worksheet names to search (basically one per year)
    B1:B100 is the column in which the item appears on each worksheet
    C1 is the item name to be searched

    The bit I'm interested in is the INDIRECT("'"&A1:A10&"'!B1:B100"). It allows me to keep adding worksheets each year and never have to retype my basic formula. I'd like to use this formula to search the same column across all worksheets, but return the first corresponding value of an adjacent column it finds. This is what I'm trying to use:

    {=(MIN(IF(INDIRECT("'"&A1:A10&"'!B1:B100")=C1,INDIRECT("'"&A1:A10&"'!D1:D100"),"-")))}

    Where:

    A1:A10 contains the list of worksheet names to search
    B1:B100 is the column in which the item appears on each worksheet
    C1 is the item name to be searched
    D1:D100 is the column from which the first item is to be returned

    But it returns #VALUE!

    If I replace the INDIRECT formula with the name of the worksheet, it works fine i.e.

    {=(MIN(IF('2017'!B1:B100=C1,INDIRECT('2017'!D1:D100"),"-")))}

    but I want to get the formula to look at all the worksheets.

    Any help?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: MIN IF function across multiple worksheets

    Why not all data on 1 worksheet (e.g. with a macro)?

    After that a pivot table to analyse the data.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: MIN IF function across multiple worksheets

    ps. As pointed out later, this formula doesn't work as expected...
    Hi all- Use the INDEX function to coerce the INDIRECT function into returning an array of values for the conditional clause. Strangely, it's not necessary for the value clause. I don't know why.
    Please Login or Register  to view this content.
    *Always press CTRL+SHIFT+ENTER to confirm entry after pasting or editing an ARRAY FORMULA in the Formula Bar.
    When copying the formula to other cells, make sure the copied cell is not part of the Paste Area.
    Last edited by leelnich; 09-05-2017 at 10:24 AM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: MIN IF function across multiple worksheets

    Oeldere, I have a lot of data on each worksheet - each one contains invoices for a year. It's important they stay separate.

  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
    44,036

    Re: MIN IF function across multiple worksheets

    What is the difference between this thread and your PREVIOUS thread for a 3D Min-IF.

    https://www.excelforum.com/excel-for...orksheets.html

    Can I suggest that you read the rules (that you have agreed to adhere to) about duplicating threads?
    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

  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
    44,036

    Re: MIN IF function across multiple worksheets

    You STILL have not responded to Post 2 (on your parallel thread), which - so far as I can see - does EXACTLY what you want.
    Last edited by Glenn Kennedy; 09-05-2017 at 03:33 AM.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: MIN IF function across multiple worksheets

    Oeldere, I have a lot of data on each worksheet - each one contains invoices for a year. It's important they stay separate.
    Why is that important?

    To my opinion it is a lot easier to analyse the data if all data are on 1 worksheet.

    Excecialy if you want to analyse the data of several years (which is what you want).

    Edit:

    Thanks Glenn for the link to the earlier question.

    I saw i made the same suggestion in #4 of that threat too.

    Maybe i am a parrot and i am repeating myself.
    Last edited by oeldere; 09-05-2017 at 06:11 AM. Reason: Edit added

  8. #8
    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
    44,036

    Re: MIN IF function across multiple worksheets

    BtW, Leelnich: does that look at all the sheets, or just the first one?

    see parallel thread...

  9. #9
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: MIN IF function across multiple worksheets

    My apologies Glenn, see my comments in the other thread.

  10. #10
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: MIN IF function across multiple worksheets

    Quote Originally Posted by oeldere View Post
    Why is that important?

    To my opinion it is a lot easier to analyse the data if all data are on 1 worksheet.

    Excecialy if you want to analyse the data of several years (which is what you want).

    Edit:

    Thanks Glenn for the link to the earlier question.

    I saw i made the same suggestion in #4 of that threat too.

    Maybe i am a parrot and i am repeating myself.
    Thanks for the multiple responses oeldere. I agree joining the data onto one sheet makes this piece of analysis easier, but I have other formulas that work better with them separate.

  11. #11
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: MIN IF function across multiple worksheets

    Quote Originally Posted by leelnich View Post
    Hi all- Use the INDEX function to coerce the INDIRECT function into returning an array of values for the conditional clause. Strangely, it's not necessary for the value clause. I don't know why.
    Please Login or Register  to view this content.
    *Always press CTRL+SHIFT+ENTER to confirm entry after pasting or editing an ARRAY FORMULA in the Formula Bar.
    When copying the formula to other cells, make sure the copied cell is not part of the Paste Area.
    Thanks leelnich, that actually works really well. The only catch is it returns 0, I think because some of the cells in D1:D100 are blank. Any idea how I can exclude blank cells?

  12. #12
    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
    44,036

    Re: MIN IF function across multiple worksheets

    Quote Originally Posted by Uomoviso View Post
    Thanks leelnich, that actually works really well. The only catch is it returns 0, I think because some of the cells in D1:D100 are blank. Any idea how I can exclude blank cells?
    no. it does NOT work. It is only looking at the first sheet in the list. See cells C7 and D7. It has got ABSOLUTELY NOTHING to do with the presence or absence of blank cells. It simply looks at the FIRST sheet in the list and then stops, returning a zero if it finds no match.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 09-05-2017 at 07:30 AM.

  13. #13
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: MIN IF function across multiple worksheets

    but I have other formulas that work better with them separate.
    Can you tell me which formulas that are?

    I also want to learn each day.

  14. #14
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: MIN IF function across multiple worksheets

    Quote Originally Posted by oeldere View Post
    Can you tell me which formulas that are?

    I also want to learn each day.
    Nothing special oeldere, it's just that each worksheet contains one financial year. I have summaries for each year that allow me to easily compare one year to the next.

  15. #15
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: MIN IF function across multiple worksheets

    Quote Originally Posted by Uomoviso View Post
    Thanks leelnich, that actually works really well...
    Glenn is correct, it DOES NOT WORK. Since you didn't include a sample workbook, I cobbled some data together. To keep it simple, I just repeated the same worksheet name 10 times. I intended to expand testing once I got rid of #VALUE! but never did, so I didn't notice the failure.
    Props to Glenn for pointing it out.
    Last edited by leelnich; 09-05-2017 at 10:01 AM.

+ 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] MIN IF function across multiple worksheets
    By Uomoviso in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 04-27-2021, 11:12 AM
  2. Function to lookup between multiple worksheets and sum
    By alexlegan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-13-2016, 05:02 PM
  3. LOOKUP function across multiple worksheets
    By Bonzopookie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2015, 10:14 AM
  4. Replies: 2
    Last Post: 01-15-2014, 11:40 PM
  5. Perform function in multiple worksheets
    By PTCMax in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-13-2011, 08:02 PM
  6. Sub for performing a function across multiple worksheets
    By hermithead in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2010, 02:14 AM
  7. VLOOKUP Function using multiple worksheets
    By Fiona in forum Excel General
    Replies: 1
    Last Post: 03-10-2005, 05:06 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