+ Reply to Thread
Results 1 to 9 of 9

Is it possible to use a defined array as the first argument in CHOOSE()?

Hybrid View

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    33

    Question Is it possible to use a defined array as the first argument in CHOOSE()?

    Hi,

    I have a CHOOSE function like this:

    =CHOOSE({1;2;3;4;5;6;7},A1,C1,E1,G1,I1,K1,M1)

    Is it possible to replace the first argument index_num {1;2;3;4;5;6;7} with a defined array?

    i.e. Array1 = {1,2,3,4,5,6,7}

    =CHOOSE(Array1,A1,C1,E1,G1,I1,K1,M1)

    It is only choosing the first value for me. I am using the CHOOSE function inside a SUMPRODUCT.

    Thanks!
    Last edited by XLOOKUP; 04-08-2016 at 12:50 PM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    Array enter the formula.

    Array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    Using Name manager in Formula Tab define the Array1 as {1,2,3,4,5,6,}
    This ARRAY function works

    =SUM(CHOOSE(Array1,A1,C1,E1,G1,I1,K1,M1))

    ARRAY function should be confirmed with Ctrl+Shift+Enter Keys together.

  4. #4
    Registered User
    Join Date
    03-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    Quote Originally Posted by Tony Valko View Post
    Array enter the formula...
    Quote Originally Posted by kvsrinivasamurthy View Post
    Using Name manager in Formula Tab define the Array1...
    Thanks for the responses, can you guys figure out why this doesn't work?

    Array1 = {1,2,3}
    Array2 = CHOOSE({1;2;3}, A1, C1, E1)

    A1 = 5 C1 = 5 E1 = 5
    A2 = 5 C2 = 5 E2 = 5

    =SUMPRODUCT(CHOOSE({1;2;3},A2,C2,E2)*Array2) gives me 75
    =SUMPRODUCT(CHOOSE(Array1,A2,C2,E2)*Array2) with CTRL+SHIFT+ENTER gives me 225

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    How is Array2 defined?

    EDIT: Never mind, I see!
    Last edited by Tony Valko; 04-08-2016 at 12:15 PM.

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    [back with previous text]
    change from first {1;2;3} to {1,2,3} and you will get 225
    Last edited by sandy666; 04-08-2016 at 01:56 PM. Reason: back

  7. #7
    Registered User
    Join Date
    03-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    Quote Originally Posted by sandy666 View Post
    change from first {1;2;3} to {1,2,3} and you will get 225
    Thanks! The answer I was looking for was 75 so I used that same logic and changed Array1 to use semicolons instead.

    EDIT - It also works if I change everything to a comma

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    Sorry, I deleted text before I saw your answer
    but I'm glad if it works and thanks for rep.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to use a defined array as the first argument in CHOOSE()?

    FYI...

    Here in the U.S. commas define a horizontal array while semi-colons define a vertical array.

    Horizontal: {1,2,3}

    Vertical: {1;2;3}

+ 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] User defined function takes array as argument but won't work with range
    By BuffaloFan32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2013, 12:50 PM
  2. SEARCH function returns array if first argument is array--Huh?
    By 6StringJazzer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-10-2012, 07:23 PM
  3. [SOLVED] ByRef argument type mismatch / Passing array as a function argument
    By pzling in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2012, 06:23 PM
  4. Integer defined array vs variant defined array ..error making assignment to integer
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2011, 01:48 PM
  5. Defined Names - choose which one to use
    By rabright in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-29-2008, 11:06 AM
  6. getting the column address of an argument to a user defined functi
    By Salman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2006, 11:00 AM
  7. [SOLVED] Using VLOOKUP with abitlity to choose from multiple defined names.
    By Armando in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-26-2006, 06:20 PM
  8. Function (array argument, range argument, string argument) vba
    By Witek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2005, 11:07 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