+ Reply to Thread
Results 1 to 7 of 7

Using IF(AND(..)) with arrays

  1. #1
    Registered User
    Join Date
    06-05-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    4

    Using IF(AND(..)) with arrays

    Hi guys.

    This is my first post on this forum, but I have been following for a while.

    I have a workbook with two sheets "DATA" and "OVERVIEW".

    In DATA I have a bunch of different arrays:
    Colm. A: Unit identifier (eg. Shampoo)
    Colm. B: Dates (03-12-2004)
    Colm. C: User identifier (eg. Michael)

    In OVERVIEW:
    Colm. A: Unit identifier (eg. Shampoo rows 2-81, then Conditioner for the next 80 rows, etc.)
    Colm. B. User identifier (eg. Michael, Lars, etc. (there is a total of 80 users), repeating for all types of units).
    Row 1: Dates

    So what I am trying to do is:
    =IF(AND(DATA!$A:$A=$A4;DATA!$B:$B=$B4;DATA!$C:$C=C$1);DATA!$K:$K;"")
    DATA!$A:$A is the unit array in DATA sheet
    $A4 is one of the units, that occurs in the data array in DATA sheet
    If this unit actually is in array A:A in DATA, then if:
    DATA!$B:$B is the user identifier array in DATA sheet
    $B4 is one of the user names, that occurs in the data array in DATA sheet
    If the user actually occurs in the B:B array of DATA and the unit from A4 is in the same row, then if the date in C1 is in the same row as where the unit and name was identified:
    DATA!$C:$C=C$1
    Return the cell value of the given row from column K in DATA.
    DATA!$K:$K

    However, nothing is returned - where am I failing?

    Im desperat for your help

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Using IF(AND(..)) with arrays

    Please upload a workbook with some sample data.

    This looks like it can be done with a pivot table, or, as an alternative, array formulas. But nobody will be keen to type up the sample data to produce the POC.

    cheers,

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695

    Re: Using IF(AND(..)) with arrays

    Typically you can't use AND in array formulas because that function returns a single value rather than an array. One option is to use SUMIFS (assuming your data in column K is numeric) but as this looks like a "lookup" type formula you can use a Lookup, try this formula

    =IFERROR(LOOKUP(2;1/(DATA!$A:$A=$A4)/(DATA!$B:$B=$B4)/(DATA!$C:$C=C$1);DATA!$K:$K);"")

    probably better, though, to restrict the ranges to the data range rather then use the whole column
    Audere est facere

  4. #4
    Registered User
    Join Date
    06-05-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Using IF(AND(..)) with arrays

    Quote Originally Posted by teylyn View Post
    Please upload a workbook with some sample data.

    This looks like it can be done with a pivot table, or, as an alternative, array formulas. But nobody will be keen to type up the sample data to produce the POC.

    cheers,
    I should have uploaded - why didn't I think of that

    Anyway here it is ... the test focus solely on "Shampoo", and does actually return ONE value for three users, whereas it should return five values for Louis (23-05-2011=3, 27-05-2011=2, etc.)
    Attached Files Attached Files

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Using IF(AND(..)) with arrays

    You can use a pivot table to show that information with just a few clicks. No need to enter formulas.

    See attached.

    cheers,
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-05-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Using IF(AND(..)) with arrays

    Quote Originally Posted by daddylonglegs View Post
    Typically you can't use AND in array formulas because that function returns a single value rather than an array. One option is to use SUMIFS (assuming your data in column K is numeric) but as this looks like a "lookup" type formula you can use a Lookup, try this formula

    =IFERROR(LOOKUP(2;1/(DATA!$A:$A=$A4)/(DATA!$B:$B=$B4)/(DATA!$C:$C=C$1);DATA!$K:$K);"")

    probably better, though, to restrict the ranges to the data range rather then use the whole column
    That actualyl works - thanks a lot. Only problem now is (I just realized), that my overview sheet contains 170*84 rows, and rougly 3000 columns, approximatly 43 mio. cells. Now my computer is a beast but no way it will cope with that. Any suggestions? Would a VBA script make sense? :|

  7. #7
    Registered User
    Join Date
    06-05-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Using IF(AND(..)) with arrays

    Quote Originally Posted by teylyn View Post
    You can use a pivot table to show that information with just a few clicks. No need to enter formulas.

    See attached.

    cheers,
    Thanks for the input. Maybe pivot is the best way to handle that amout of data - I'll give it a shot

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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