Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I hide rows that have a field with a particular entry

I have a spreadsheet with a code field. I want to produce another spreadsheet where all the entries have a particular character in this code field. Can this be done by hiding the rows that don't have this character in the code field and if so how can I hide these entries automatically?

iMac, Mac OS X (10.7), MacBook Pro, iPhone4, iPad

Posted on Nov 22, 2011 4:46 PM

Reply
Question marked as Best reply

Posted on Nov 22, 2011 5:05 PM

The brute force method of doing this would be for the second table to be filled with formulas like


=IF(Table 1::A1 = "", "", Table 1::A1)


which will make a complete copy of the first table. Then use Reorganize (which you'll find on the toolbar) to create a filter to show only rows that have that particular code in whatever column it is in.

9 replies
Question marked as Best reply

Nov 22, 2011 5:05 PM in response to RobbieSnr

The brute force method of doing this would be for the second table to be filled with formulas like


=IF(Table 1::A1 = "", "", Table 1::A1)


which will make a complete copy of the first table. Then use Reorganize (which you'll find on the toolbar) to create a filter to show only rows that have that particular code in whatever column it is in.

Nov 22, 2011 11:31 PM in response to RobbieSnr

Your second Table can be set up to transfer only the rows containing the specific code you are looking for.


One way to do that is to create an Index column on the main table, then use LOOKUP to return rows based on the values in the Index column.


Here's a small example.


The Main table is on the left, the Breakout Table on the right.


The target code in the example is selected from a pop-up menu in cell A1.

User uploaded file

Two formulas are used, one in the cells of the Index column on the Main table, the other in all cells below the top row in the Breakout table.


Main:

E2 (and filled down the rest of column E): =IF(A=Breakout :: $A$1,MAX($E$1:E1)+1,"")


Breakout:

A2 (Filled right to column C, Filled down to the bottom of each column):

=IF(ROW()-2<MAX(Main :: $E),LOOKUP(ROW()-1,Main :: $E,Main :: B),"")


Values used in the body cells are sample ones intended to show the original cell address of the content, and the code used on that row.


Dscriptions of the functions used can be found in the iWork Formulas and Functions User Guide, available through the Help menu in Numbers.


Regards,

Barry

Nov 23, 2011 2:59 AM in response to Badunit

Thanks Badunit for that suggestion. I need to produce two different subsets of the original table and I had been thinking of starting off by duplicating the orignal table twice and then hiding the relevant rows once I'd found out how to do this so your suggestion would have worked. However I liked Barry's one so that avoided the copying so I've given him the 10 marks and you 5.


Regards

Eric.

Nov 27, 2011 3:36 PM in response to Barry

Barry, I've worked through your example and got it working as you suggested, which is grand. I do have to change it though as my code field is a composite one, composed of a set of alphanumeric characters, and I'm searching for a particular character in it. I've tried to use IF(A="*M*") to produce the index column but it won't accept this, although I did get it working with IF(A="M").


Is there a way to get round this?

Nov 27, 2011 6:51 PM in response to RobbieSnr

Hi Eric,


Here's an edited formula that will index any line whose code in column a includes the chosen character (or string fo characters) set in A! of the Breakout Table. Note that I've changed the codes, and reduced the pop-up choices to individual letters. Each of the three letters in the example is included in six of the codes.

User uploaded file


=IFERROR(IF(FIND(Breakout :: $A$1 ,A2)>0,MAX($E$1:E1)+1,""),"")

OR

=IFERROR(IF(FIND(Breakout :: $A$1 ,A2)>0,MAX($E$1:E1)+1),"")


If the string is found, FIND returns a number corresponding to the position of the first character of the search-string in the source-string, which is always greater than 0, and the if-condition is evaluated as TRUE.


If the string is not found, FIND returns an error, which is trapped by IFERROR, and the formula returns a null string. FIND will never return a zero or less than zero value, so the if-false argument of IF may be left out of the formula (as is done in the second version).


Note that FIND is case sensitive; set to find “M”. it will not find “m”. For multiple-character strings, there must be an exact match. FIND(“ab”,source-string) will return a number for “abc” or “babz”, but will return an error for “BAC”, bABz”, “4a b5” or “a b c”.


Although no example is shown above, the formula will also index longer codes containing the target letter in any position.


Regards,

Barry


Nov 28, 2011 8:45 AM in response to RobbieSnr

I've tried to use IF(A="*M*") to produce the index column but it won't accept this, although I did get it working with IF(A="M").


Though you already have it working, another solution to your question (if I understood what you want) is


IF(ISERROR(SEARCH("M",A)), "doesn't contain an M", "does contain an M")


another, which is case sensitive but doesn't require the catching of an error, would be


=IF(SUBSTITUTE(A,"M","")=A, "doesn't contain an M", "does contain an M")


And Barry's, which is also case sensitive, written a different way


=IF(ISERROR(FIND("M",A)), "doesn't contain an M", "does contain an M")

Nov 30, 2011 2:12 AM in response to Badunit

Thanks Badunit, that's very useful.


I see from what you say that Barry didn't need his '>0' and that the ISERROR could have been put inside the IF, and that replacing the FIND with a SEARCH would have made the search case insensitive.


I've not done much work with spreadsheets, the most complicated to date being a What If one in Excel but I'm always keen to learn more. I work mainly with Perl, and like it there's more than one way to do something.


Regards

Eric.

How can I hide rows that have a field with a particular entry

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.