Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
1ceman
 
Posts: n/a
Default If cell contains text then ......


Hi,

Having a braindead morning here.

I have 3 columns a=number, b=customer, c=quantity.

Column B has various customer names.
In column D, I need a formula which says if b2 contains text of any
kind then show the text with (2) tagged on the end.
ie if collins is showing in b2 then d2 should show Collins(2)

Apologies for this, head all over


--
1ceman
------------------------------------------------------------------------
1ceman's Profile: http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If cell contains text then ......

=if(b2="","",b2&"(2)")

Maybe????

1ceman wrote:

Hi,

Having a braindead morning here.

I have 3 columns a=number, b=customer, c=quantity.

Column B has various customer names.
In column D, I need a formula which says if b2 contains text of any
kind then show the text with (2) tagged on the end.
ie if collins is showing in b2 then d2 should show Collins(2)

Apologies for this, head all over

--
1ceman
------------------------------------------------------------------------
1ceman's Profile: http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default If cell contains text then ......

=IF(ISTEXT(B2),B2&2,"")

Vaya con Dios,
Chuck, CABGx3


"1ceman" wrote in
message ...

Hi,

Having a braindead morning here.

I have 3 columns a=number, b=customer, c=quantity.

Column B has various customer names.
In column D, I need a formula which says if b2 contains text of any
kind then show the text with (2) tagged on the end.
ie if collins is showing in b2 then d2 should show Collins(2)

Apologies for this, head all over


--
1ceman
------------------------------------------------------------------------
1ceman's Profile:

http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089



  #4   Report Post  
Posted to microsoft.public.excel.misc
1ceman
 
Posts: n/a
Default If cell contains text then ......


Ampersand !!!!!

Thanks guys !!!!


--
1ceman
------------------------------------------------------------------------
1ceman's Profile: http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089

  #5   Report Post  
Posted to microsoft.public.excel.misc
1ceman
 
Posts: n/a
Default If cell contains text then ......


Guys, obviously, it works well.

Thanks for that.

Next Q......

Can this be done in vba using xlformulas?

Cheers

Jeff


--
1ceman
------------------------------------------------------------------------
1ceman's Profile: http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089



  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If cell contains text then ......

Are you trying to update the values in place?

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range

With Worksheets("sheet1")
Set myRng = .Range("b2", .Cells(.Rows.Count, "B").End(xlUp))
End With

For Each myCell In myRng.Cells
If myCell.Value = "" Then
'do nothing
Else
myCell.Value = myCell.Value & "(2)"
End If
Next myCell
End Sub

or if you wanted to update column C:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range

With Worksheets("sheet1")
Set myRng = .Range("b2", .Cells(.Rows.Count, "B").End(xlUp))
End With

For Each myCell In myRng.Cells
If myCell.Value = "" Then
'clear out the cell????
mycell.offset(0,1).value = ""
Else
myCell.offset(0, 1).Value = myCell.Value & "(2)"
End If
Next myCell
End Sub

Be aware that the first routine will destroy any formulas in column B.


1ceman wrote:

Guys, obviously, it works well.

Thanks for that.

Next Q......

Can this be done in vba using xlformulas?

Cheers

Jeff

--
1ceman
------------------------------------------------------------------------
1ceman's Profile: http://www.excelforum.com/member.php...o&userid=34213
View this thread: http://www.excelforum.com/showthread...hreadid=540089


--

Dave Peterson
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
Cell Capacity - text i2meek Excel Discussion (Misc queries) 4 March 13th 06 12:06 AM
How can I make an excel cell equal to the value of a frame object text box directionalman Excel Worksheet Functions 1 February 27th 06 09:24 PM
Cell text based on 4 condition test Bob Wall Excel Worksheet Functions 3 November 16th 05 07:34 PM
Autofitting a row Josephine Excel Discussion (Misc queries) 2 March 3rd 05 03:37 PM
Formatting a cell as "text" in the number catagory. Ed Excel Worksheet Functions 3 December 7th 04 07:12 PM


All times are GMT +1. The time now is 11:03 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"