Better Substitute that If Function

K

KimC

I'm needing to display the correct area code for the corresponding postcode,
row two is the example i'm needing to display. The postcode is already there,
it the area code i need the formula for.

A B
1 Postcode AreaCode
2 2148 02

The data is
1XXX & 2XXX = 02
3XXX, 7XXX & 8XXX = 03
4XXX & 9XXX = 07
0XXX, 5XXX & 6XXX = 08

The "X" refer to different numbers that may be entered.

Thanks in advance
 
B

Bob Quintal

I'm needing to display the correct area code for the corresponding
postcode, row two is the example i'm needing to display. The
postcode is already there, it the area code i need the formula
for.

A B
1 Postcode AreaCode
2 2148 02

The data is
1XXX & 2XXX = 02
3XXX, 7XXX & 8XXX = 03
4XXX & 9XXX = 07
0XXX, 5XXX & 6XXX = 08

The "X" refer to different numbers that may be entered.

Thanks in advance

select case left(postcode,1)
case "1" , "2"
areacode = "02"
case "3" , "7" , "8"
areacode = "03"
case "4" , "9"
areacode = "07"
case "0" , "5" , "6"
areacode = "08"
case else
areaCode = "indeterminate"
end select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top