+ Reply to Thread
Results 1 to 15 of 15

Grab value from a range based on certain criteria

  1. #1
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Post Grab value from a range based on certain criteria

    My input ranges are D2:I2; D4:I5.
    D2:I2 generates positive number. It may also generate 0 or “” (null).
    D4:I4 has 3 values “A”; “B” & “C” and balance 3 cells contains “” (null).
    Output Range1:M2:R2 It should contain all numbers from D2:I2 in increasing order i.e. from minimum to maximum, going from left to right.
    Output Range2: U2:W2
    U2=value from D2:I2 where the corresponding cell in D4:I4 contains “A”
    V2=value from D2:I2 where the corresponding cell in D4:I4 contains “B”
    W2=value from D2:I2 where the corresponding cell in D4:I4 contains “C”

    How to accomplish? Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Grab value from a range based on certain criteria

    How about
    In M2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in U2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    It worked Fluff13. But when I made G2="" (null), the formulas gave
    R2=#NUM! (Complete: 0, 7, 12, 20, 33, #NUM! for D2:I2=20, 33, 0, "", 12, 7). I want it to give "", 0, 7, 12, 20, 33 preferable OR otherwise 0, 0, 7, 12, 20, 33
    V2=0 Can the formula give here "" (since "" in G2)

  4. #4
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    Also, can the formula be re-adjusted to 'ignore' corresponding values from D2:I2 when it finds "Z" in D4:I4 while 'arranging' values in M2:R2. For such "z" corresponding cells, the formula should give 0.

  5. #5
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Grab value from a range based on certain criteria

    Try Cell U2 formula , Drag right , the copy U2:W2 ranges and paste to Cell U4

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by wk9128; 02-03-2022 at 06:58 PM.

  6. #6
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    Formula works well for U2:W2. What about the formula for M2:R2 to avoid #NUM! for cell in D2:I2 containing "" (null)

  7. #7
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Grab value from a range based on certain criteria

    ans post #6

    M2

    Cell M2 formula , drag right

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by wk9128; 02-03-2022 at 04:20 AM.

  8. #8
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    wk9128, Your first formula works well for me. But I would like to know what is being done by COLUMN(A$1)

  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,410

    Re: Grab value from a range based on certain criteria

    COLUMN(A$1) will return the number of the column (here 1). As you drag right, the column letter will increment, and with it the number returned.
    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.

  10. #10
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    Hold on…wk9128
    Your first formula is treating 0s in D2:I2 as a value ‘which has to be considered’ for sorting.
    For example: D2:I2 is 0, 88, 0, “”, “”, 77
    Formula is giving (in M2:R2) 0, 0, 77, 88, “”, “” (wrong)
    I need: 77, 88, “”, “”, “”, “”
    Please see the attached file.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    Okay learned

  12. #12
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Grab value from a range based on certain criteria

    Try this formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    Yes. Now it works perfectly well.

  14. #14
    Forum Contributor
    Join Date
    10-18-2019
    Location
    Mumbai
    MS-Off Ver
    OFFICE 2010
    Posts
    427

    Re: Grab value from a range based on certain criteria

    wk9128,
    Is your formula of post #12 very volatile. My Excel file got hanged today when I used it for the first time today, using real time feed data in D2:I2
    If it is volatile, can I get a less volatile formula

    Similarly, less volatile required against post #5 formula for U2:W2 range

  15. #15
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Grab value from a range based on certain criteria

    @bittubadri

    No volatile here , when you see a formula with OFFSET or INDIRECT is a volatile formula
    Upload the attachment in question, the formula seems to be fine

+ 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] Grab Numbers Meeting Criteria From List
    By omarc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-28-2021, 01:05 AM
  2. Replies: 1
    Last Post: 04-09-2021, 11:09 AM
  3. [SOLVED] Grab lines of data from sheet based on multiple criteria (working slightly)
    By kai. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2018, 04:43 AM
  4. Replies: 7
    Last Post: 02-02-2013, 11:13 PM
  5. Help needed urgently / grab certain criteria from master to several sheets
    By theresasjh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-04-2012, 03:13 PM
  6. Grab lowest date based on criteria
    By SeanKosmann in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-06-2010, 04:36 PM
  7. VB Macro to grab Pivot Cell Criteria
    By Lotus123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2010, 05:49 PM

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