7 Replies Latest reply: Apr 30, 2018 6:06 AM by Chase Ramsey RSS

    Filter to include rows based on content of rows above and below?

    Chase Ramsey

      Hi everyone,

       

      I am a new Monarch user and have a feeling this question may be incredibly obvious, so I apologize in advance if it is.

       

      I am using Monarch to search for a list of keywords within a PDF document, and generate a report that includes every line of the PDF document that contains one of those keywords. I am accomplishing this by bringing in each line of the PDF document into a column ("Report"), and then searching each of those lines individually and extracting the keywords into another column ("Keywords") using regexextract. I then filter the "Keywords" column to exclude all rows containing a blank. This leaves me with the "Report" column only showing rows in which a keyword is present, and the "Keywords" column showing me all of the keywords that were found in that row.

       

      What I would like to accomplish is to also include the lines preceding and following the lines in which a keyword is present. So, if a keyword is present in line 20 I would like the "Report" column to have lines 19, 20, and 21.

       

      Please let me know if you would like further explanation or examples. And thanks in advance!