PC Review


Reply
Thread Tools Rate Thread

CONCATENATE IF macro or function?

 
 
FJ
Guest
Posts: n/a
 
      17th Oct 2008
Hi, I’m using the following formula to pull data from several worksheets onto
another worksheet:
=CONCATENATE("Product 1: ",Sheet1!A1,"
","Product 2: ",Sheet2!A1,"
","Product 3: ",Sheet3!A1)

This gives me the following result, assuming that the data in A1 on Sheets
1, 2, and 3 was Apples, Oranges, and Pears, respectively:
Product 1: Apples
Product 2: Oranges
Product 3: Pears

This works fine. The only problem is if there were no data in, say, cell A1
on Sheet3. Then my results would look like this:
Product 1: Apples
Product 2: Oranges
Product 3:

I would like to use a formula or a macro that would allow me to do a sort of
“concatenate if” type of thing, so that if a cell is blank, it would not
concatenate the “Product” part. I’m not sure if this can be done with a
regular Excel formula. I thinking it might need a user defined function or a
macro, if it’s possible at all. Can anyone help? Thanks in advance for any
information.
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      17th Oct 2008
Hi,

It's a bit messy but here's a formula to do it.

=IF(Sheet1!A1<>"","Product 1: "& Sheet1!A1&" ","")&
IF(Sheet2!A1<>"","Product 2: "& Sheet2!A1&" ","")&IF(Sheet3!A1<>"","Product
3: "& Sheet3!A1,"")

Mike

"FJ" wrote:

> Hi, I’m using the following formula to pull data from several worksheets onto
> another worksheet:
> =CONCATENATE("Product 1: ",Sheet1!A1,"
> ","Product 2: ",Sheet2!A1,"
> ","Product 3: ",Sheet3!A1)
>
> This gives me the following result, assuming that the data in A1 on Sheets
> 1, 2, and 3 was Apples, Oranges, and Pears, respectively:
> Product 1: Apples
> Product 2: Oranges
> Product 3: Pears
>
> This works fine. The only problem is if there were no data in, say, cell A1
> on Sheet3. Then my results would look like this:
> Product 1: Apples
> Product 2: Oranges
> Product 3:
>
> I would like to use a formula or a macro that would allow me to do a sort of
> “concatenate if” type of thing, so that if a cell is blank, it would not
> concatenate the “Product” part. I’m not sure if this can be done with a
> regular Excel formula. I thinking it might need a user defined function or a
> macro, if it’s possible at all. Can anyone help? Thanks in advance for any
> information.

 
Reply With Quote
 
FJ
Guest
Posts: n/a
 
      17th Oct 2008
Hi, Mike, thank you so much! Your formula worked great! I didn't
think this could be done with a regular formula. I always learn so much from
these discussion groups.

Thanks again!




"Mike H" wrote:

> Hi,
>
> It's a bit messy but here's a formula to do it.
>
> =IF(Sheet1!A1<>"","Product 1: "& Sheet1!A1&" ","")&
> IF(Sheet2!A1<>"","Product 2: "& Sheet2!A1&" ","")&IF(Sheet3!A1<>"","Product
> 3: "& Sheet3!A1,"")
>
> Mike
>
> "FJ" wrote:
>
> > Hi, I’m using the following formula to pull data from several worksheets onto
> > another worksheet:
> > =CONCATENATE("Product 1: ",Sheet1!A1,"
> > ","Product 2: ",Sheet2!A1,"
> > ","Product 3: ",Sheet3!A1)
> >
> > This gives me the following result, assuming that the data in A1 on Sheets
> > 1, 2, and 3 was Apples, Oranges, and Pears, respectively:
> > Product 1: Apples
> > Product 2: Oranges
> > Product 3: Pears
> >
> > This works fine. The only problem is if there were no data in, say, cell A1
> > on Sheet3. Then my results would look like this:
> > Product 1: Apples
> > Product 2: Oranges
> > Product 3:
> >
> > I would like to use a formula or a macro that would allow me to do a sort of
> > “concatenate if” type of thing, so that if a cell is blank, it would not
> > concatenate the “Product” part. I’m not sure if this can be done with a
> > regular Excel formula. I thinking it might need a user defined function or a
> > macro, if it’s possible at all. Can anyone help? Thanks in advance for any
> > information.

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      17th Oct 2008
Glad I could help

"FJ" wrote:

> Hi, Mike, thank you so much! Your formula worked great! I didn't
> think this could be done with a regular formula. I always learn so much from
> these discussion groups.
>
> Thanks again!
>
>
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > It's a bit messy but here's a formula to do it.
> >
> > =IF(Sheet1!A1<>"","Product 1: "& Sheet1!A1&" ","")&
> > IF(Sheet2!A1<>"","Product 2: "& Sheet2!A1&" ","")&IF(Sheet3!A1<>"","Product
> > 3: "& Sheet3!A1,"")
> >
> > Mike
> >
> > "FJ" wrote:
> >
> > > Hi, I’m using the following formula to pull data from several worksheets onto
> > > another worksheet:
> > > =CONCATENATE("Product 1: ",Sheet1!A1,"
> > > ","Product 2: ",Sheet2!A1,"
> > > ","Product 3: ",Sheet3!A1)
> > >
> > > This gives me the following result, assuming that the data in A1 on Sheets
> > > 1, 2, and 3 was Apples, Oranges, and Pears, respectively:
> > > Product 1: Apples
> > > Product 2: Oranges
> > > Product 3: Pears
> > >
> > > This works fine. The only problem is if there were no data in, say, cell A1
> > > on Sheet3. Then my results would look like this:
> > > Product 1: Apples
> > > Product 2: Oranges
> > > Product 3:
> > >
> > > I would like to use a formula or a macro that would allow me to do a sort of
> > > “concatenate if” type of thing, so that if a cell is blank, it would not
> > > concatenate the “Product” part. I’m not sure if this can be done with a
> > > regular Excel formula. I thinking it might need a user defined function or a
> > > macro, if it’s possible at all. Can anyone help? Thanks in advance for any
> > > information.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Concatenate function Snowy Microsoft Excel Programming 7 10th Jan 2011 06:13 AM
CONCATENATE FUNCTION! pyager Microsoft Excel Worksheet Functions 4 29th Sep 2008 05:12 PM
CONCATENATE/& Function ? =?Utf-8?B?QXNo?= Microsoft Excel Misc 5 23rd Feb 2007 04:57 PM
Concatenate Function =?Utf-8?B?TG91?= Microsoft Excel Worksheet Functions 3 18th Oct 2004 02:49 AM
Concatenate Function =?Utf-8?B?c3RtdHM=?= Microsoft Excel Worksheet Functions 1 17th Oct 2004 04:04 AM


Features
 

Advertising
 

Newsgroups
 


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