+ Reply to Thread
Results 1 to 5 of 5

ROW() inside OFFSET() inside IF() not expanding array always!

  1. #1
    Registered User
    Join Date
    11-22-2016
    Location
    California
    MS-Off Ver
    Office 2016
    Posts
    3

    ROW() inside OFFSET() inside IF() not expanding array always!

    I have a complex worksheet/graph I'm building that requires a lot of array building. I've run into either a bug or a side-effect that prevents an array function from being evaluated properly when used in the following order of functions:

    IF ( condition, OFFSET( ref, ROW(A1:A4), col))

    Normally, OFFSET( ref, ROW(A1:A4) will give you an array of values. But the version inside the IF function doesn't work as expected when evaluating with the F9 key or the Evaluate Formula tool. Interestingly it does when performed with CSE (Ctrl+Shift+Enter).

    I'm attaching a link to a minimal working example to illustrate the difference in behavior. Is there some way around this? I've tried using CHOOSE as well with no luck.

    Link: Bad Functions! ROW in OFFSET in IF
    Last edited by tralston; 11-22-2016 at 10:37 PM. Reason: Didn't finish the first time.

  2. #2
    Forum Contributor
    Join Date
    11-21-2015
    Location
    Philippines
    MS-Off Ver
    Microsoft Office 2016
    Posts
    146

    Re: ROW() inside OFFSET() inside IF() not expanding array always!

    I really do not understand what you are exploring.
    If you want to display results for "NO OFFSET" is {0;"";"";3} , use your formulas:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Ctrl + Shift + Enter!
    If you want to display results for "WITH OFFSET" is {"Apple";"";"";"Dog"} , use this formulas:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Ctrl + Shift + Enter!
    You can use F9 to check it!

  3. #3
    Registered User
    Join Date
    11-22-2016
    Location
    California
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: ROW() inside OFFSET() inside IF() not expanding array always!

    Tamthat, thanks for your response. Your method will work for the example I gave. But for what I need, the OFFSET function is necessary. I should have provided a better example. I will update the link in the morning.

    The reason is because OFFSET allows you to not be restricted by 1:1 mapping. For instance, you can transform a 3x3 matrix into a 9x1 column. In my case, I'm needing transformations that aren't 1:1. So under "WITH OFFSET", but before apply the IF logic, if I wanted {"Apple";"Apple";"Ball";"Ball";"Car";"Car";"Dog";"Dog"}, I couldn't do that without OFFSET. I think of OFFSET like a way to perform programmatic loops. Sure, stepping from 1 to 4 with OFFSET is overkill, but when going from 1 to 10 by 2's or stepping through a range by prime numbers, or some other more complex pattern, you need OFFSET to accomplish this.

    Now that I've hopefully explained why OFFSET is required, I hope our focus can turn back to the problem at hand. I'd also like to point out that I'm developing this workbook on Excel 2016 but it needs to be compatible with Excel 2010 (other users will use my template). And VBA is not an option.

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: ROW() inside OFFSET() inside IF() not expanding array always!

    Hi
    See if this helps you. Try in G6 the following formula (and see with F9)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-22-2016
    Location
    California
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: ROW() inside OFFSET() inside IF() not expanding array always!

    I have updated the example Excel file in the link above. Please refer to this example now.

    @Jose, yes, this works fine for a reference range of A1:A4, but if I try anything else (see post #3 by me above) it doesn't. Please see the new example.

+ 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] [VBA - Help] Offset/Move Value - Details Inside...
    By timdecker in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-28-2016, 02:37 PM
  2. [SOLVED] How to restrict pop of message box inside multiple times when it is inside a for loop?
    By timmu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2014, 06:00 AM
  3. VBA offset inside a formula
    By Rompetelo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-03-2013, 07:24 AM
  4. Expanding Range inside a Formula
    By par0016 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-05-2013, 12:15 PM
  5. Replies: 1
    Last Post: 10-02-2012, 04:27 PM
  6. adding dynamic formula inside loop to insert into offset cell
    By smartphreak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2011, 02:57 AM
  7. Using Offset inside a Vlookup
    By tibzy in forum Excel General
    Replies: 1
    Last Post: 03-31-2010, 08:21 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