ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Multiple address lines in an 'if' (https://www.excelbanter.com/excel-discussion-misc-queries/176414-multiple-address-lines-if.html)

Learner101b

Multiple address lines in an 'if'
 
I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b

Yanick

Multiple address lines in an 'if'
 
Use this.

=IF(E2=1,"ABC Company" & CHAR(10) & "123 Street" & CHAR(10) & "Anytown,
StateZip","DEF Company" & CHAR(10) & "456 Road" & CHAR(10) & "Anytown, State
Zip")

You need to check the "wrap text" box in the cell alignment format.
--
Yanick


"Learner101b" wrote:

I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b


Dave Peterson

Multiple address lines in an 'if'
 
And you really used alt-enter instead of this literal <alt-enter, right?

Did you remember to turn on wraptext?

Format|Cells|Alignment tab|check Wrap Text
(xl2003 menus)

And remember that merged cells don't react nicely to autofitting the rowheight.
You'll have to adjust that manually.

Learner101b wrote:

I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b


--

Dave Peterson

Learner101b

Multiple address lines in an 'if'
 
Works like a charm. Thank you very much.

Curiosity question:
How did you know a 'return' was 'char' 10?

Learner010b

"Yanick" wrote:

Use this.

=IF(E2=1,"ABC Company" & CHAR(10) & "123 Street" & CHAR(10) & "Anytown,
StateZip","DEF Company" & CHAR(10) & "456 Road" & CHAR(10) & "Anytown, State
Zip")

You need to check the "wrap text" box in the cell alignment format.
--
Yanick


"Learner101b" wrote:

I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b


Yanick

Multiple address lines in an 'if'
 
I knew it for my C++ programming in DOS. ASCII code for line feed is 10.

Take a look there to have a list of all code
http://www.asciitable.com/

I am sure you can have a lot of info on google if you search for ASCII.

Have fun!
--
Yanick


"Learner101b" wrote:

Works like a charm. Thank you very much.

Curiosity question:
How did you know a 'return' was 'char' 10?

Learner010b

"Yanick" wrote:

Use this.

=IF(E2=1,"ABC Company" & CHAR(10) & "123 Street" & CHAR(10) & "Anytown,
StateZip","DEF Company" & CHAR(10) & "456 Road" & CHAR(10) & "Anytown, State
Zip")

You need to check the "wrap text" box in the cell alignment format.
--
Yanick


"Learner101b" wrote:

I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b


Learner101b

Multiple address lines in an 'if'
 
Thank you for all of you help!
.. . . Learner101b

"Yanick" wrote:

I knew it for my C++ programming in DOS. ASCII code for line feed is 10.

Take a look there to have a list of all code
http://www.asciitable.com/

I am sure you can have a lot of info on google if you search for ASCII.

Have fun!
--
Yanick


"Learner101b" wrote:

Works like a charm. Thank you very much.

Curiosity question:
How did you know a 'return' was 'char' 10?

Learner010b

"Yanick" wrote:

Use this.

=IF(E2=1,"ABC Company" & CHAR(10) & "123 Street" & CHAR(10) & "Anytown,
StateZip","DEF Company" & CHAR(10) & "456 Road" & CHAR(10) & "Anytown, State
Zip")

You need to check the "wrap text" box in the cell alignment format.
--
Yanick


"Learner101b" wrote:

I want to insert an address into a merged cell depending on a location cell.
When I use the code below, Excel does not recognize the <alt enter. Any
ideas?

=IF(E2=1,"ABC Company<alt enter123 Street<alt enterAnytown, State
Zip","DEF Company<alt enter456 Road<alt enterAnytown, State Zip")

The <alt enter does not work in this text box, but I think you will
understand what I want to do.

Thanks for any help.
Learner101b



All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com