Validating Australian Post Code Range - Conditional Formatting Formula

louisepr

New Member
Joined
Nov 5, 2020
Messages
25
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi :)
I am looking to validate Australian Postal Codes (column I) based on the state value in column H with conditional formatting if possible
The postcode of each state must start with the number as listed below. So, If State = SA and Postcode does not start with 5, highlight the cell. Or If State = QLD and Postcode does not start with 4, highlight the cell etc.
SA 5,
QLD 4
NSW 2
VIC 3
WA 6
TAS 7
ACT 2
NT 0

1612400001224.png


Thanks in advance :)
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
5,952
Office Version
  1. 2016
Platform
  1. Windows
Hi,

One way.
Create a State and Postal Code table as in my sample (Must be in Alpha Order),
Then use the formula for Conditional Formatting:

Book3.xlsx
HIJKLM
1StatePostcodeACT2
2NSW2
3SA3095TRUENT0
4SA5114FALSEQLD4
5SA5034FALSESA5
6VIC5114TRUETAS7
7VIC3095FALSEVIC3
8VIC3029FALSEWA6
Sheet731
Cell Formulas
RangeFormula
J3:J8J3=LEFT(I3)+0<>LOOKUP(H3,L$1:L$8,M$1:M$8)


If you don't want to have a State/Postal Code table in your sheet, we can Hardcode the Table within the formula, let me know.
 
Solution

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
5,952
Office Version
  1. 2016
Platform
  1. Windows
You're welcome, thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,681
Messages
5,626,254
Members
416,168
Latest member
DROP_DATABASE_MrExel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top