+ Reply to Thread
Results 1 to 10 of 10

Combining IF and OFFSET

  1. #1
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Combining IF and OFFSET

    Hello all,

    I've been struggling to find an answer to this problem, so thought I'd try on this site, as people seemed to be friendly and willing...

    I wrote this formula, and it is doing what I want, but seems a little bulky for what I need it to do.

    =OFFSET(INDEX(Table1[Quantity],MATCH(1,INDEX((Table1[Quantity]=LARGE(Table1[Quantity],ROWS(F$31:F31)))*(COUNTIF(F$31:F31,Table1[Quantity])=0),),0)),,-16)

    In short, it looks up the highest value from a table, and then returns the information I want via OFFSET. When I drag down to duplicate, it give me the second highest, and so on and so forth. I only actually need it for the top 10 though.

    What I wanted to do was to create two more formulas. One adds an IF function and the other adds an IFS function. They work on the same principle though. So I started, failed over and over until I decided to strip down the component pieces. When doing so I stumbled across this formula...

    {=LARGE(IF(Table1[Tribe]="Gaul",Table1[Quantity],),1)}

    This successfully gives me the highest number, that meets the condition of "Gaul". So, I want to then OFFSET that. The base component to move from D5 to C5 is...

    =OFFSET(D5,,-1,,)

    So in my mind all I have to do is place the LARGE array formula in the D5 and I should get the cell to the left of my highest quantity Gual.

    =OFFSET({=LARGE(IF(Table1[Tribe]="Gaul",Table1[Quantity],),1)},,-1,,)

    or

    {=OFFSET(=LARGE(IF(Table1[Tribe]="Gaul",Table1[Quantity],),1),,-1,,)}

    Both say that they see an error in my formula, I don't understand. I feel like the same root problem in my understand is affecting both the original formula and this one.


    I hope I have given enough detail.
    Regards,
    Attached Files Attached Files
    Last edited by hurrell8510; 09-13-2016 at 01:19 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,214

    Re: Combining IF and OFFSET

    It would help if you posted a sample Excel file (not image) showing expected results.

    To upload a file click "Go Advanced" then scroll down to "Manage Attachments"

  3. #3
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Re: Combining IF and OFFSET

    Thank you. Done.

    To aid the upload a little the bit that I'm looking at is Table8[#All] which can be found in the tab Extraction in the cells B46:G55. The table pulls the information from the tab Index. I've got the row numbers of where I expect to find the data currently in the Player column, for you ease of reference.

    Many thanks to anyone willing to take a look at this.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,214

    Re: Combining IF and OFFSET

    Try

    in C46

    =INDEX(Table1[Player],SMALL(IF(Table1[Tribe]="Gaul",ROW(Table1[Rank])-ROW(Index!$A$3)+1,""),ROWS(Index!$A$3:A3)))

    in D46

    =INDEX(Table1[Alliance],SMALL(IF(Table1[Tribe]="Gaul",ROW(Table1[Rank])-ROW(Index!$A$3)+1,""),ROWS(Index!$A$3:A3)))

    Enter both with Ctrl+Shift+Enter
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Re: Combining IF and OFFSET

    Ahhhh, that is so much cleaner. I can actually read and understand what's going on too. I've had quick play and applied your fix to the first extraction table too. I'm going to get rid of all the OFFSET formulas in there.

    Many thanks for your help. I didn't expect anything so quickly!! I hope it didn't didn't take too much of your time.

  6. #6
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Re: Combining IF and OFFSET

    Actually this formula doesn't work when duplicating to other measurements or when using the dynamic nature of the first table. It only works in this given example.

    Your code gives me the highest ranked Gaul listed in the table, not the highest by wheat. So when the table in changed, for example to Attack Strength, then the highest placed by Attack strength is listed in the wheat column, not the highest listed by wheat). When I make the new table (For Gauls by Attack Strength) it currently lists it in order of highest wheat, as the table was listed by wheat at that moment.
    Attached Files Attached Files
    Last edited by hurrell8510; 09-14-2016 at 05:33 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,214

    Re: Combining IF and OFFSET

    If you want to rank by "Wheat" then use this format:

    =INDEX(Table1[Player],MATCH("wheat",Table1[wheat],0)

    where "wheat" is required cell reference

    Copy down

  8. #8
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Re: Combining IF and OFFSET

    No I don't want to simply rank by wheat, although that formula looks much tidier than what I have.

    In one table I want to rank by Wheat, out of the Gauls. Then in another table I want to rank Attack Strength, out of the Guals. Then in another table I want to rank Quantity, out of the Gauls.

    Then, I'll do the same for Romans and Teutons

    Then when I understand this, I will do another which will do it by servers. This will put two conditions on the data a "server" match and a "round" match.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,214

    Re: Combining IF and OFFSET

    You already have the rankings of Gaul & Wheat, Gaul & Attack etc in Column F of your tables

    in C46

    =INDEX(Table1[Player],MATCH(F46,Table1[wheat],0)


    will give you player matching "wheat" ranking in F46

    in C59

    =INDEX(Table1[Player],MATCH(F59,Table1[Attack Stength],0)

    will give you player matching "Attack Strength" ranking in F59

  10. #10
    Registered User
    Join Date
    09-13-2016
    Location
    Korea
    MS-Off Ver
    2013
    Posts
    11

    Re: Combining IF and OFFSET

    Ahhhh, ofc, I was being so thick. I was making it way too hard for myself. Thank you so much for your time and patience. I really appreciate it. You've saved me a lot of time and effort. If you enjoy a class of wine, I'd be more than happy to get a bottle or two reserved in a local store as a gesture of good will.

    Regards,

+ 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. Need help in combining IF into OffSET
    By shuriyan0924 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-27-2015, 04:07 AM
  2. [SOLVED] Combining Offset or Index and Sum functions
    By tonylyx in forum Excel General
    Replies: 3
    Last Post: 01-26-2015, 12:33 AM
  3. Help with combining OFFSET and MAX Function
    By oyz79 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-16-2013, 06:23 PM
  4. Combining offset, address, and match
    By rhart00 in forum Excel General
    Replies: 2
    Last Post: 04-26-2010, 07:01 PM
  5. Combining Vlookup and Offset
    By wout_st in forum Excel General
    Replies: 0
    Last Post: 02-19-2008, 12:45 PM
  6. Combining vlookup with offset?
    By dlloyd in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-08-2007, 09:10 AM

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