+ Reply to Thread
Results 1 to 10 of 10

Trying to do an Index with small if for the first time

  1. #1
    Registered User
    Join Date
    09-24-2012
    Location
    Carlisle, PA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Trying to do an Index with small if for the first time

    Hi I am trying to retrieve the quantity for a part number from all locations in another workbook. The following is close but it brings back the quantity from 2 part numbers below the ones I want. Any help would be appreciated, I am very new to Excel.

    =INDEX([FSL_Inventory.xls]DATA!$D$3:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$3:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159)),ROWS(1:1)),3)

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Trying to do an Index with small if for the first time

    perhaps change to

    =INDEX([FSL_Inventory.xls]DATA!$D$1:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$3:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159)),ROWS(1:1)),3)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    09-24-2012
    Location
    Carlisle, PA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Trying to do an Index with small if for the first time

    Ace_XL, The have headers in D1 and D2

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Trying to do an Index with small if for the first time

    Please Login or Register  to view this content.
    This portion of the formula will not return a value less than 3, hence you will always INDEX 3 rows from DATA!$D$3:$J$34159 i.e row 5 even if the D3 = A5, hence start 2 rows higher

  5. #5
    Registered User
    Join Date
    09-24-2012
    Location
    Carlisle, PA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Trying to do an Index with small if for the first time

    I do not understand. Are you saying because I do not use d1, that I will always be off by 2? the 1st occurance of the part number is d1561, I want to return e1561..I sort of thought the problem might be with the end of the formula Rows(1:1)),3) but I have tried to change several times

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Trying to do an Index with small if for the first time

    the problem lies here...

    ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159) starts with Row 3!

    You could simply change to
    =INDEX([FSL_Inventory.xls]DATA!$D$3:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$3:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159)),ROWS(1:1))-2,3)

  7. #7
    Registered User
    Join Date
    09-24-2012
    Location
    Carlisle, PA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Trying to do an Index with small if for the first time

    I tried changing d3 to d1 and when I got the same result tried -2,3 after rows(1,1)...received the same

  8. #8
    Registered User
    Join Date
    09-24-2012
    Location
    Carlisle, PA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Trying to do an Index with small if for the first time

    t values should be used for "ROWS(1:1))-2,3" part of the statement...???

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Trying to do an Index with small if for the first time

    There are two solutions. The simplest in my mind is change all the D3 references to D1. Ace showed in post #2 that same idea, but only changes one, you have to change them all. This will work. Rows 1 and 2 are headers so they will never match your criteria and thus will always be skipped, but the result is the rows will now always match the INDEX range.

    =INDEX([FSL_Inventory.xls]DATA!$D$1:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$1:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$1:$J$34159)),ROWS(1:1)),3)

    The less attractive solution in my mind is to "adjust" the row() references by -2.

    =INDEX([FSL_Inventory.xls]DATA!$D$3:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$3:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159)-2),ROWS(1:1)),3)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Trying to do an Index with small if for the first time

    The standard method I use is to subtract the ROW of the first cell and add 1, i.e.

    =INDEX([FSL_Inventory.xls]DATA!$D$3:$J$34159,SMALL(IF([FSL_Inventory.xls]DATA!$D$3:$J$34159=$A$5,ROW([FSL_Inventory.xls]DATA!$D$3:$J$34159)-ROW([FSL_Inventory.xls]DATA!$D$3)+1),ROWS(1:1)),3)

    Of course it's longer but more robust. If you add or delete rows at the top of the sheet the formula results won't change. For the same reason I prefer to base ROWS function on the start cell, e.g. if the first formula is in D3 change ROWS(1:1) to match - i.e. ROWS(D$3:D3)
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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