+ Reply to Thread
Results 1 to 26 of 26

Extract all values in a range

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Extract all values in a range

    Looking for formula to extract all values in range A7:A22 of sheet named Products to another sheet named Extract. See attached sample file.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    Could you please explain why copy and paste would not be a suitable solution?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    Values changes from time to time. Wants formula driven approach to eliminate manual work. Thanks

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    So it's simply reading the data across, is it? When you say values change, what exactly do you mean? Will the list grow? Will rows sometimes be deleted from anywhere in the range? All of these things will affect any solution offered.

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract all values in a range

    Enter this array formula in cell A4 and copy across and then down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ***Array formula
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.
    You will know the array is active when you see curly braces { } appear around your formula.
    If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Attached Files Attached Files
    Last edited by AlKey; 08-27-2016 at 11:55 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    Yes, the list will grow. Rows will be deleted. Yes, values will change.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    OK, then the formula provided in post #5 will not work for you - I have tested it by deleting a row from the source data, and it fails at that point. I am sure that AlKey will have a better idea - I'll have a think about it, too.

  8. #8
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    Okay. Will be on the lookout for a working solution. Thanks

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    Please do not send PMs to members pestering them for help - this is in breach of forum rule #4:

    4. Don't Private Message or email Excel questions to moderators or other members. (or Word, Access, etc.) The point of having a public forum is to share solutions to common (and sometimes uncommon) problems with all members.
    I am going offline now for the evening. I am sure someone will be able to help. I shall be back online tomorrow morning.

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    AliGW: thanks for making me aware of rule #4. Enjoy the rest of your evening.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    Thanks. Hope you get a solution!

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extract all values in a range

    Quote Originally Posted by AliGW View Post
    OK, then the formula provided in post #5 will not work for you - I have tested it by deleting a row from the source data, and it fails at that point.
    The only reason it fails upon row deletions is because AlKey used:

    ROW($A$7:$A$22)

    rather than the more robust:

    ROW(Products!$A$7:$A$22)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  13. #13
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    XOR LX: great...works. Can this also start from Products!A7:A22 instead of Products!A:A? Would like it to start from Products!A7:A22

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extract all values in a range

    Quote Originally Posted by bjnockle View Post
    XOR LX: great...works. Can this also start from Products!A7:A22 instead of Products!A:A? Would like it to start from Products!A7:A22
    No. You misunderstand. It is currently calculating over rows 7-22 only.

    Although this is not the only method, AlKey's decision to use Products!A:A as the array to pass to INDEX is a good one, since this way we reduce the construction required to pass as the row_num parameter.

    Regards

  15. #15
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    Okay - thanks XOR LX. Nice feedback. Testing now.

  16. #16
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    XOR LX: Did not get it to work on my end. Products!A:A is making it pull data from the first row instead of row 7. can you help with the index approach? Thanks

  17. #17
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extract all values in a range

    Quote Originally Posted by bjnockle View Post
    XOR LX: Did not get it to work on my end. Products!A:A is making it pull data from the first row instead of row 7. can you help with the index approach? Thanks
    But we're referring to the file AlKey posted, correct?

    So only the reference immediately after the INDEX should be to a full column, i.e. Products!A:A. The others, after IF, ROW, etc., need to reference explicitly the required range, e.g. Products!$A$7:$A$22.

    But this is all just so in AlKey's attached file, so not sure where the confusion could have arisen?

    The only time I'd avoid the method given by AlKey is if you were actually using an Excel Table, in which case it's better to consistently reference the same range. However, this appears to not be the case here.

    Regards

  18. #18
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    when I changed it to
    =IFERROR(INDEX(Products!$A$7:$A$21,SMALL(IF((Products!$A$7:$A$21=Products!$A$2)+(Products!$A$7:$A$21=Products!$A$3)+(Products!$A$7:$A$21=Products!$A$4),ROW(Products!$A$7:$A$21)),ROWS(A$4:A4))),"")
    , the formula picks up the values from Apple instead of Mango.

    Please Login or Register  to view this content.

  19. #19
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extract all values in a range

    ??

    Did you read my last post?

    Quote Originally Posted by XOR LX View Post
    So only the reference immediately after the INDEX should be to a full column, i.e. Products!A:A. The others, after IF, ROW, etc., need to reference explicitly the required range, e.g. Products!$A$7:$A$22.
    Regards

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    when I changed it to
    =IFERROR(INDEX(Products!$A$7:$A$21,SMALL(IF((Products!$A$7:$A$21=Products!$A$2)+(Products!$A$7:$A$21=Products!$A$3)+(Products!$A$7:$A$21=Products!$A$4),ROW(Products!$A$7:$A$21)),ROWS(A$4:A4))),"")
    Don't change the first reference after the INDEX function - leave it as Products!A:A.

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

    Re: Extract all values in a range

    Quote Originally Posted by bjnockle View Post
    =IFERROR(INDEX(Products!$A$7:$A$21,SMALL(IF((Products!$A$7:$A$21=Products!$A$2)+(Products!$A$7:$A$21=Products!$A$3)+(Products!$A$7:$A$21=Products!$A$4),ROW(Products!$A$7:$A$21)),ROWS(A$4:A4))),"")
    I haven't downloaded any files but here's how I would write that formula...

    =IFERROR(INDEX(Products!A:A,SMALL(IF(ISNUMBER(MATCH(Products!$A$7:$A$21,Products!$A$2:$A$4,0)),ROW(Products!$A$7:$A$21)),ROWS(A$4:A4))),"")

    Still array entered.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  22. #22
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract all values in a range

    All suggested solutions works like a charm. Thanks Tony Valko, AliGW, XOR LX and AlKey.

  23. #23
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract all values in a range

    You're welcome. Please don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

  24. #24
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,863

    Re: Extract all values in a range

    You're welcome!

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

    Re: Extract all values in a range

    You're welcome. Thanks for the feedback!

  26. #26
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extract all values in a range

    Likewise!

    Cheers

+ 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] Extract Unique values in range
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-08-2014, 06:39 AM
  2. [SOLVED] Extract range based on cell values
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-21-2014, 11:11 AM
  3. Extract range between two values and save as new file
    By GDM69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2013, 10:09 AM
  4. How to find and extract values in a range
    By Even in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-12-2012, 05:16 AM
  5. Replies: 3
    Last Post: 11-24-2011, 06:11 AM
  6. Macro Loop to Extract Specific Values and Min/Max Values From Column/Rows Range
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-19-2010, 09:19 AM
  7. [SOLVED] Formula to Extract Values within a Range
    By prkhan56 in forum Excel General
    Replies: 3
    Last Post: 07-21-2005, 02:05 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