Oct 13, 2020 03:52 PM
Hi all,
[Spoiler: I’m not an IT professional and am pretty new to AT, so thank you in advance for bearing with me :slightly_smiling_face: ]
I have made a ‘contact’ base to hold client addresses, with the following fields (these need to be split out this way for other operations elsewhere);
Address 1
Address 2
Town/City
County
Postcode
Very often, one or two of these are vacant (usually Address 2 and/or County). Postcode might be, too.
Ideally I also need to show an address as a single line, with the fields separated by commas. When I use the formula;
CONCATENATE({Address Line 1}, ", ", {Address Line 2}, ", ",{Town/ City}, ", ",(County), ", ",(Postcode))
I get commas between the empty fields;
Is there a way to skip the empty fields to give the output format;
Addr1, City, Postcode, if those are the only fields populated?
Thanks for any help in advance :slightly_smiling_face:
Mike
Oct 13, 2020 04:16 PM
Try this:
{Address Line 1} &
IF({Address Line 2}, ", " & {Address Line 2}) &
IF({Town/ City}, ", " & {Town/ City}) &
IF({County}, ", " & {County}) &
IF({Postcode}, ", " & {Postcode})
Oct 13, 2020 04:22 PM
Thank you so much Kamille! Works perfectly.
Now I can spend tomorrow figuring how that works :slightly_smiling_face:
Thanks again - very much appreciated.
Mike
Oct 13, 2020 04:33 PM
Explanation:
CONCATENATE()
appends each comma-separated argument together.IF()
statement asks “does this particular field have a value?”
IF()
statements don’t have the third argument declared: IF([scenario], [value if true], [value if false])
. When the [value if false]
argument is omitted from an IF()
statement, the formula uses blank space as the value, which in this case is what you want.Oct 15, 2020 08:50 AM
That is so kind of you Kamille, thank you :thumbs_up: :clap: