+ Reply to Thread
Results 1 to 16 of 16

Extracting data with two conditions

  1. #1
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Unhappy Extracting data with two conditions

    Hi all, I have been trying to extract each row that contains a specific date and status. I have tried multiple websites and for some reason I cannot solve my issue.

    As seen in the picture, I wish to extract all the specified date that ALSO contains the accepted status "YES".

    This formula is not related to the image I created as an example but it might give you a sense of what I have been attempting: =IF(ROWS($I$7:I7)>$K$4,"",INDEX(A$4:A$12,SMALL(IF($A$4:$A$12>=$I$4,IF($A$4:$A$12<=$J$4,ROW($A$4:$A$12)-ROW($A$4)+1)),ROWS($I$7:I7))))

    extraction.png

    Thank you,

    Any advice would be awesome. If you need me to be more specific let me know.

    - Jason

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,165

    Re: Extracting data with two conditions

    Hi Jason,

    I think, instead of a formula you should be using an Advanced Filter or even Auto Filter to see your results.

    http://www.contextures.com/xladvfilter01.html

    http://www.wikihow.com/Use-AutoFilter-in-MS-Excel
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Extracting data with two conditions

    1 autofilter
    2 formulas =IFERROR(INDEX(bd!A$2:A$2000,INDEX($D$1:$N$1,ROW($A1))),"")
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-13-2016
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    82

    Re: Extracting data with two conditions

    wt about =Vlookup ?

  5. #5
    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,288

    Re: Extracting data with two conditions

    What about VLOOKLUP, Bkcffee? Do you have an alternative suggestion? If so, please post your formula here.
    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.

  6. #6
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Re: Extracting data with two conditions

    Hi Tim,

    This seems to be what I am looking for. Are you able to just explain what is happening in D1 please?

    Thank you

  7. #7
    Registered User
    Join Date
    07-28-2017
    Location
    Athens, Greece
    MS-Off Ver
    2010 and 2013
    Posts
    11

    Lightbulb Re: Extracting data with two conditions

    Please see the attached file for the solution.
    Some of the Formulas:

    1) Sheet1, New column I.
    I2:=A2&F2

    2) Sheet2,
    I2:=COUNTA(Sheet1!A1:A10)-1
    I7:=IFERROR(MATCH($A$2&$B$2,Sheet1!$I$1:$I$10,0),"")
    I8:=IFERROR(I7+MATCH($A$2&$B$2,OFFSET(INDIRECT(ADDRESS($I7+1,9,,,"Sheet1")),0,0,$I$2-$I7+1,1),0),"")
    A7:=IFERROR(INDEX(Sheet1!$A$2:$I$10,MATCH($A$2&$B$2,Sheet1!$I$2:$I$10,0),MATCH(A$6,Sheet1!$A$1:$I$1,0)),"")
    A8:==IFERROR(INDEX(OFFSET(INDIRECT(ADDRESS($I7+1,1,,,"Sheet1")),0,0,$I$2-$I7+1,9),MATCH($A$2&$B$2,OFFSET(INDIRECT(ADDRESS($I7+1,9,,,"Sheet1")),0,0,$I$2-$I7+1,1),0),MATCH(A$6,Sheet1!$A$1:$I$1,0)),"")

  8. #8
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Extracting data with two conditions

    in d1 and to the right SMALL returns row numbers which meets the conditions

  9. #9
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Re: Extracting data with two conditions

    Thank you Imatzav, this is great.

    I am going to have a play with this now. I was also looking to do one additional thing. Two or more of the columns would contain names. I would like to search multiple columns and return the number of unique names found combined in all columns. Is this possible?

    Columns with names.png

  10. #10
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Extracting data with two conditions

    =SUM(1/COUNTIF(C2:D10,C2:D10))-1 as array formula
    Last edited by tim201110; 07-30-2017 at 12:32 PM. Reason: was russian

  11. #11
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Re: Extracting data with two conditions

    Is that in Russian?

  12. #12
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Extracting data with two conditions

    now in English
    =SUM(1/COUNTIF(C2:D10,C2:D10))-1

  13. #13
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Re: Extracting data with two conditions

    Hi Imatzav / Tim

    Thank you again for your help.

    I am attempting to apply your shared knowledge whilst learning simultaneously.

    I have made an error somewhere - my data is quite huge. (1000+ rows by 123 Columns) I also only want to extract specific columns and not necessarily in order. I hope this is not going to cause too many problems.


    I understand we are counting all the rows -the row headers, in my case in K2 I have -3 as my data begins on the 4th row. (I hope I am correct).

    K7 - This seems to have identified the first row that matches both criteria (as I know there are more than 1 match).

    I7 - We want to extract the first row and then the following rows that match both criteria, if there is an error return nothing .... then I am a bit lost ....

    I have removed my data to show how my raw inputted data is formatted (this is what I need to extract to sheet2)

    Thank you for your support - it is awesome

    Date and status extract.xls

  14. #14
    Registered User
    Join Date
    07-28-2017
    Location
    Athens, Greece
    MS-Off Ver
    2010 and 2013
    Posts
    11

    Lightbulb Re: Extracting data with two conditions

    Quote Originally Posted by Jacehigh View Post
    Thank you Imatzav, this is great.

    I am going to have a play with this now. I was also looking to do one additional thing. Two or more of the columns would contain names. I would like to search multiple columns and return the number of unique names found combined in all columns. Is this possible?

    Attachment 530772
    See the attached file.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-28-2017
    Location
    Athens, Greece
    MS-Off Ver
    2010 and 2013
    Posts
    11

    Lightbulb Re: Extracting data with two conditions

    Quote Originally Posted by Jacehigh View Post
    Hi Imatzav / Tim

    Thank you again for your help.

    I am attempting to apply your shared knowledge whilst learning simultaneously.

    I have made an error somewhere - my data is quite huge. (1000+ rows by 123 Columns) I also only want to extract specific columns and not necessarily in order. I hope this is not going to cause too many problems.


    I understand we are counting all the rows -the row headers, in my case in K2 I have -3 as my data begins on the 4th row. (I hope I am correct).

    K7 - This seems to have identified the first row that matches both criteria (as I know there are more than 1 match).

    I7 - We want to extract the first row and then the following rows that match both criteria, if there is an error return nothing .... then I am a bit lost ....

    I have removed my data to show how my raw inputted data is formatted (this is what I need to extract to sheet2)

    Thank you for your support - it is awesome

    Attachment 530780
    See the new file. Check if this works correctly. I don't have the time right to check it more myself.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    07-29-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    14

    Talking Re: Extracting data with two conditions

    You have been more than enough help already. Works perfect. I will keep going over it until I understand it.

    Thank you all for your contribution

+ 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] Extracting data from a string using conditions
    By Terry-J in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2017, 06:22 PM
  2. Extracting the Count based on several Conditions
    By harshalcr9 in forum Excel General
    Replies: 4
    Last Post: 06-27-2016, 03:19 AM
  3. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  4. [SOLVED] Extracting data from the middle of a cell depending on a set of conditions
    By geneticsstudent in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2015, 11:06 AM
  5. [SOLVED] Extracting a value on 2 Conditions
    By daveb86 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-04-2014, 01:47 PM
  6. Extracting data giving conditions
    By Nero_slk in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-14-2013, 10:26 AM
  7. Extracting unique data that meets specific conditions
    By tekobayashi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-07-2013, 08:44 AM

Tags for this Thread

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