+ Reply to Thread
Results 1 to 12 of 12

Transposing a table view

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Transposing a table view

    Hi,

    Pls see attached WB.

    Preferable solution using only Sheet Formulas only.

    Thanks, Elm
    Attached Files Attached Files
    Last edited by ElmerS; 10-29-2009 at 09:32 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transposing a table view

    One way without helpers etc avoiding arrays and double evaluation

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Thanks a lot, or as we use to say: Takk a einhver fjöldi

    Elm

    ***************************************
    Added Later:

    What can be put in the formula instead of using the Choose function.

    This is only out of curiosity.

    Thanks
    Last edited by ElmerS; 10-29-2009 at 10:02 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transposing a table view

    Nothing easily... the use of CHOOSE is to negate need for double evaluation (to handle errors) - with helpers or repetitive calcs you can dispense with it but in the context of your question (and limitations thereof) the approach is worth utilising.

  5. #5
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Hi,

    I was not underestimating your solution.

    I just wonder if the use of choose can be replaced by an If(IsErr... although it will make the formula much longer.

    Elm

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transposing a table view

    The CHOOSE is one way of handling errors and is in essence used to populate a lookup_vector with 2 values, a null string and the output of the INDEX formula so you end up with

    Please Login or Register  to view this content.
    If the formula output returns an error it will be ignored by the LOOKUP and the Null will be returned as that is the last text string within the lookup_vector, if on the other hand the INDEX output is valid the LOOKUP will return that value as that is the last text string in the lookup_vector, eg:

    Please Login or Register  to view this content.
    If you want to dispense with CHOOSE, given sample file, then you could just as easily use a COUNT test initially to determine as to whether or not result required, ie:

    Please Login or Register  to view this content.
    In reality the above will also prove to be the more efficient option.

  7. #7
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Thanks you.

  8. #8
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Thanks, DonkeyOte

    May I use this opportunity to ask (as explained within the attached WB) regarding what you have suggested earlier in this thread.

    Elm
    Attached Files Attached Files

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transposing a table view

    Per your sample where you're returning numerics or nulls to account for errors...

    Utilising CHOOSE in conjunction with LOOKUP to negate double evaluation

    a) won't really shorten the formula in this instance given the original is not that long

    b) given you're returning mixed data types (numbers, text) whereas the LOOKUP method is designed for single data type (ie always number or always text)
    more specifically a Null is a text string


    In terms of alternatives...

    If (and only if) Qty is never 0 then you can just use SUMIF and simply apply a Custom Number Format to display / print 0 as blank.

    In the case of the third table where you have a matrix and column criteria may not exist then you SUMIF not viable.

    IMO you should do as you are and validate the existence of the criteria first before conducting any calculations . that is another disadvantage of the LOOKUP approach - ie the "calculation" is performed at all times and if it's an expensive one that can be easily avoided it's not really an optimal approach.
    Last edited by DonkeyOte; 10-31-2009 at 03:13 AM.

  10. #10
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Thanks, again,

    Are you familiar with some site(s) where I can see more improvisations of using: CHOOSE({1,2},"",... in conjunction with LOOKUP ?

    I tried to Google but no success.

    Elm

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transposing a table view

    I'm not sure I really understand... the earlier posts detail how the approach works... I'm not really sure what else you're expecting to find.

    To reiterate then...

    With regard to use of CHOOSE in context in LOOKUP to circumvent need for double evaluation:

    -- CHOOSE is used to create a lookup_vector of 1 to n values

    -- the "default" value (first value) should be of the same data type as that of the criteria

    -- the Criteria value of the LOOKUP must exceed all values within the lookup_vector

    To illustrate

    =LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,10*10))

    generates a 2 value lookup_vector which will evaluate to {0,100} the result of the LOOKUP will be 100 as this is the last value in the lookup_vector of the same data type as the criteria.

    =LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,10*"a"))

    will return 0 as the 10*"a" will generate an error value and given this is not of the same data type as the criteria (number) it is ignored and thus 0 is the last value of the same data type as the criteria found in the lookup_vector

    =LOOKUP(9.99999999999999E+307,CHOOSE({1,2},"",10*"a"))

    will generate an error as neither value in the lookup_vector are of the same data type as the criteria.

    The last example illustrates my point regards your earlier formula which generate Null (text) for error or number if valid - given that requirement (mixed data type output) the LOOKUP/CHOOSE approach is not really viable.

  12. #12
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Transposing a table view

    Will look into it.
    Thanks

+ 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