Multiple search and conditional formatting

%3CLINGO-SUB%20id%3D%22lingo-sub-2568313%22%20slang%3D%22en-US%22%3EMultiple%20search%20and%20conditional%20formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2568313%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20weird%20one%3A%3C%2FP%3E%3CP%3E-%20I%20have%20a%20spreadsheet%20with%20patient%20names%2C%20addresses%20etc.%3C%2FP%3E%3CP%3E-%20I%20need%20to%20filter%20out%20all%20postcodes.%20I%20have%20a%20list%20of%20post%20codes%20for%20post%20codes%20within%20an%20%22allowed%22%20area%20and%20ones%20that%20are%20out%20of%20area.%3C%2FP%3E%3CP%3E-%20I%20am%20manually%20searching%20and%20then%20using%20conditional%20formatting%20to%20colour%20yellow%20and%20then%20once%20I%20have%20searched%20the%20entire%20list%20of%20post%20codes%20within%20the%20sheet%2C%20I%20can%20use%20the%20column%20sorting%20to%20hide%20all%20conditional%20formatting%20cells%20to%20show%20all%20remaining%20addresses%20that%20were%20not%20in%20the%20post%20code%20list.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20did%20try%20an%20IF%20statement%20to%20put%20the%20many%20post%20codes%20in%20there%20and%20the%26nbsp%3B%20a%20sort%20and%20then%20a%20count%20but%20it%20didn't%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECatch%20is%2C%20the%20post%20codes%20that%20are%20part%20of%20the%20patient%20addresses%20are%20in%20the%20same%20cells%20therefore%20cannot%20to%20sorted%20into%20any%20order%20as%20it%20would%20sort%20the%20street%20number%20instead%20of%20the%20post%20code.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20a%20total%20of%2084%20post%20codes%20that%20are%20%22allowed%22%20in%20a%20list%20of%20a%20few%20thousand%20patients.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20so%20highlight%20the%20allowed%20post%20codes%20in%20their%20column%20and%20then%20name%20it%20so%20i%20could%20reference%20it%20in%20an%20equation%20but%20it%20didn't%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20I%20should%20do%20a%20Macro%20and%20then%20perform%20all%20the%20searches%20with%20conditional%20formatting%20but%20how%20do%20I%20save%20the%20macro%20so%20that%20it%20will%20work%20on%20any%20spreadsheet%20when%20I%20do%20a%20databse%20extraction%20for%20this%20sort%20of%20stuff%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2568313%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2575528%22%20slang%3D%22en-US%22%3ERe%3A%20Multiple%20search%20and%20conditional%20formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2575528%22%20slang%3D%22en-US%22%3ECan%20you%20perhaps%20show%20us%20an%20Excel%20file%20with%20some%20anonymized%20sample%20data%3F%20Just%20a%20couple%20of%20rows%20will%20suffice%2C%20as%20long%20as%20it%20contains%20both%20%22valid%22%20and%20%22invalid%22%20codes.%20All%20other%20columns%20can%20be%20cleared.%20I%20assume%20you%20have%20a%20list%20of%20%22Valid%22%20post%20codes%20somewhere%2C%20make%20sure%20you%20include%20that%20list%20(but%20convert%20it%20to%20fake%20codes)%20Here%20too%20we%20only%20need%20a%20couple%20of%20codes.%3CBR%20%2F%3EImportant%3A%20make%20sure%20your%20sample%20file%20only%20contains%20made%20up%20addresses%20and%20no%20names%20of%20people.%3C%2FLINGO-BODY%3E
Occasional Contributor

I have a weird one:

- I have a spreadsheet with patient names, addresses etc.

- I need to filter out all postcodes. I have a list of post codes for post codes within an "allowed" area and ones that are out of area.

- I am manually searching and then using conditional formatting to colour yellow and then once I have searched the entire list of post codes within the sheet, I can use the column sorting to hide all conditional formatting cells to show all remaining addresses that were not in the post code list.

 

I did try an IF statement to put the many post codes in there and the  a sort and then a count but it didn't work.

 

Catch is, the post codes that are part of the patient addresses are in the same cells therefore cannot to sorted into any order as it would sort the street number instead of the post code. 

 

There is a total of 84 post codes that are "allowed" in a list of a few thousand patients.

 

I tried so highlight the allowed post codes in their column and then name it so i could reference it in an equation but it didn't work.

 

Maybe I should do a Macro and then perform all the searches with conditional formatting but how do I save the macro so that it will work on any spreadsheet when I do a databse extraction for this sort of stuff?

6 Replies
Can you perhaps show us an Excel file with some anonymized sample data? Just a couple of rows will suffice, as long as it contains both "valid" and "invalid" codes. All other columns can be cleared. I assume you have a list of "Valid" post codes somewhere, make sure you include that list (but convert it to fake codes) Here too we only need a couple of codes.
Important: make sure your sample file only contains made up addresses and no names of people.

@Jan Karel Pieterse 

Hi
Thanks for the message.
While I was waiting for a reply, I ended up doing a Find for all postcodes that were within the numbers I needed and then highlighted them in yellow. Then I Chose to Hide all the rows that had no fill. It was a long way of doing it as there are 83 post codes that I needed to filter for Invalid/out of area post codes.

I have attached some screen shots. Unfortunately, the address column has the street number and name in it and cannot be separated otherwise it would be a sinch! I have replaced the street name and number with "123 None Street" so you can see the formatting etc...

Thanks for your help, I really appreciate it

Looks as if the post codes are always the last four characters in the cell? Anyway, if you ask an Excel question, why not attach an Excel file, not a screen-shot.
Yes that is right and Because I had to redact a lot of information..... just to get the screenshot while keeping the quality of the data there

@Jan Karel Pieterse 

If you prefer for a spreadsheet then I can..... this has very limited data and I don't know if it will impact anything...

I didn't realise a screenshot would be an issue.

@laurenwhelan Looks like all your addresses have the post code as the last four characters. In that case, there's a relatively simple formula, see attached. I added an extra column on the right-hand side of the table and I converted your post code list to a table as well (tblPostCodes).