Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Combining Cell Content

Good Morning:

I have two cells that contain address information, one is mailing and the
other is street address.

I want to create a formula to compare both cell and to let me know if the
address if the same, if the address is not the same I want to combine them.

I know that to combine a cell I use the formula:
=A2&B2

How do a enter a paragraph mark in between them? meaning how to lines
instead of one long address without breaks?

example:

A2 = 109 Vine Hill & B2 = 3023 Leight Avenue

Result:
109 Vine Hill
3023 Leight Avenue

NOT: 109 Vine Hill 3023 Leight Avenue

But if A2 and B2 are the same, I want to show the address only once.

Example:

A2 = 109 Vine Hill & B2 = 109 Vine Hill

Result:

109 Vine Hill

NOT: 109 Vine Hill 109 Vine Hill

One more variable than I didn't think about, if cell B2 is empty how can I
make sure that only A2 is populated and that I don't have a blank line on the
bottom?

Example:

A2 = 109 Vine Hill & B2 = (Empty)

Result:
109 Vine Hill

NOT:
109 Vine Hill
(Empty Line)



Thank you for your help.

Sincerely,

PaolaAndrea

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Combining Cell Content

=IF(B2="",A2,IF(A2=B2,A2,A2&CHAR(10)&B2))

So if either B2 is empty or B2 match A2, only A2 is used.

Be sure to format the cell as "wrap"
--
Gary''s Student - gsnu200785


"PaolaAndrea" wrote:

Good Morning:

I have two cells that contain address information, one is mailing and the
other is street address.

I want to create a formula to compare both cell and to let me know if the
address if the same, if the address is not the same I want to combine them.

I know that to combine a cell I use the formula:
=A2&B2

How do a enter a paragraph mark in between them? meaning how to lines
instead of one long address without breaks?

example:

A2 = 109 Vine Hill & B2 = 3023 Leight Avenue

Result:
109 Vine Hill
3023 Leight Avenue

NOT: 109 Vine Hill 3023 Leight Avenue

But if A2 and B2 are the same, I want to show the address only once.

Example:

A2 = 109 Vine Hill & B2 = 109 Vine Hill

Result:

109 Vine Hill

NOT: 109 Vine Hill 109 Vine Hill

One more variable than I didn't think about, if cell B2 is empty how can I
make sure that only A2 is populated and that I don't have a blank line on the
bottom?

Example:

A2 = 109 Vine Hill & B2 = (Empty)

Result:
109 Vine Hill

NOT:
109 Vine Hill
(Empty Line)



Thank you for your help.

Sincerely,

PaolaAndrea

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Combining Cell Content

Try this:

=IF(A1="","",IF(OR(EXACT(A1,B1),B1=""),A1,A1&CHAR( 10)&B1))

Format the column that you're using for this formula to "Wrap Text".

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"PaolaAndrea" wrote in message
...
Good Morning:

I have two cells that contain address information, one is mailing and the
other is street address.

I want to create a formula to compare both cell and to let me know if the
address if the same, if the address is not the same I want to combine
them.

I know that to combine a cell I use the formula:
=A2&B2

How do a enter a paragraph mark in between them? meaning how to lines
instead of one long address without breaks?

example:

A2 = 109 Vine Hill & B2 = 3023 Leight Avenue

Result:
109 Vine Hill
3023 Leight Avenue

NOT: 109 Vine Hill 3023 Leight Avenue

But if A2 and B2 are the same, I want to show the address only once.

Example:

A2 = 109 Vine Hill & B2 = 109 Vine Hill

Result:

109 Vine Hill

NOT: 109 Vine Hill 109 Vine Hill

One more variable than I didn't think about, if cell B2 is empty how can I
make sure that only A2 is populated and that I don't have a blank line on
the
bottom?

Example:

A2 = 109 Vine Hill & B2 = (Empty)

Result:
109 Vine Hill

NOT:
109 Vine Hill
(Empty Line)



Thank you for your help.

Sincerely,

PaolaAndrea



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy comment content to cell content as data not as comment Lilach Excel Discussion (Misc queries) 2 June 21st 07 12:28 PM
Combining formulas, "and" & "or" to verify content of multiple cel Shu of AZ Excel Discussion (Misc queries) 15 October 15th 06 11:22 PM
Combining cell contents when there is content to combine Richard Excel Discussion (Misc queries) 2 June 21st 06 07:30 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"