#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Search in cell

Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to populate it
from column B but only when column B has "WI" as the first 2 characters.
If it does copy the contents from column from position 4 in the cell into
Column A. This column then needs to be populated down until the next WI is
found in column B.

Can you help?

BEFORE

Col A Col B Col C
WI: Ab23
John data
JIM data
WI: sd34

AFTER

Col A Col B Col C
Ab23 John data
Ab23 JIM data
sd34
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Search in cell

With the first WI:Ab23 in row 2
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

With the first WI:Ab23 in row 1
In A1 use: =MID(B1,4,255)
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Paul Dennis" wrote in message
...
Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to populate
it
from column B but only when column B has "WI" as the first 2 characters.
If it does copy the contents from column from position 4 in the cell into
Column A. This column then needs to be populated down until the next WI is
found in column B.

Can you help?

BEFORE

Col A Col B Col C
WI: Ab23
John data
JIM data
WI: sd34

AFTER

Col A Col B Col C
Ab23 John data
Ab23 JIM data
sd34



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default Search in cell

try this

leave first row blank.

In cell A2 put this formula and drag it down.

=IF(LEFT(B2,2)="WI",MID(B2,FIND(":",B2)+1,255),A1)



On Oct 21, 6:34*pm, Paul Dennis
wrote:
Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to populate it
from column B but only when column B has "WI" as the first 2 characters.
If it does copy the contents from column from position 4 in the cell into
Column A. This column then needs to be populated down until the next WI is
found in column B.

Can you help?

BEFORE

Col A * * Col B * * * * Col C
* * * * * * * WI: Ab23
* * * * * * * John * * * * *data
* * * * * * * JIM * * * * * *data
* * * * * * * WI: sd34

AFTER

Col A * * Col B * * * * Col C
Ab23 * *John * * * * *data
Ab23 * *JIM * * * * * *data
sd34


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Search in cell

Thx for this, however I'm doing it in a Macro???

"Bernard Liengme" wrote:

With the first WI:Ab23 in row 2
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

With the first WI:Ab23 in row 1
In A1 use: =MID(B1,4,255)
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Paul Dennis" wrote in message
...
Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to populate
it
from column B but only when column B has "WI" as the first 2 characters.
If it does copy the contents from column from position 4 in the cell into
Column A. This column then needs to be populated down until the next WI is
found in column B.

Can you help?

BEFORE

Col A Col B Col C
WI: Ab23
John data
JIM data
WI: sd34

AFTER

Col A Col B Col C
Ab23 John data
Ab23 JIM data
sd34




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Search in cell

No I mean I have a macro to do this, hence I can't actually put anything in a
call. I want to be able to call a macro to do the job.

"muddan madhu" wrote:

try this

leave first row blank.

In cell A2 put this formula and drag it down.

=IF(LEFT(B2,2)="WI",MID(B2,FIND(":",B2)+1,255),A1)



On Oct 21, 6:34 pm, Paul Dennis
wrote:
Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to populate it
from column B but only when column B has "WI" as the first 2 characters.
If it does copy the contents from column from position 4 in the cell into
Column A. This column then needs to be populated down until the next WI is
found in column B.

Can you help?

BEFORE

Col A Col B Col C
WI: Ab23
John data
JIM data
WI: sd34

AFTER

Col A Col B Col C
Ab23 John data
Ab23 JIM data
sd34





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Search in cell

Sub tryme()
mylast = Cells(Cells.Rows.Count, "B").End(xlUp).Row
For j = 1 To mylast
If Mid(Cells(j, 2), 1, 2) = "WI" Then
Cells(j, 1) = Mid(Cells(j, 2), 4, 255)
Else
Cells(j, 1) = Cells(j - 1, 1)
End If
Next
End Sub

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Paul Dennis" wrote in message
...
Thx for this, however I'm doing it in a Macro???

"Bernard Liengme" wrote:

With the first WI:Ab23 in row 2
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

With the first WI:Ab23 in row 1
In A1 use: =MID(B1,4,255)
Use in A2: =IF(LEFT(B2,2)="WI",MID(B2,4,255),A1)
Copy down the column

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Paul Dennis" wrote in message
...
Hi,

I have done a before and after to help

I have several columns of data. Column A is blank and I want to
populate
it
from column B but only when column B has "WI" as the first 2
characters.
If it does copy the contents from column from position 4 in the cell
into
Column A. This column then needs to be populated down until the next WI
is
found in column B.

Can you help?

BEFORE

Col A Col B Col C
WI: Ab23
John data
JIM data
WI: sd34

AFTER

Col A Col B Col C
Ab23 John data
Ab23 JIM data
sd34






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
Search for a cell. Tree*Rat Excel Discussion (Misc queries) 2 October 20th 08 05:41 PM
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
Search and go to cell furby Excel Worksheet Functions 2 October 8th 07 01:26 PM
How to search for text within a cell? Eric Excel Discussion (Misc queries) 9 May 13th 07 04:30 PM
format cell to search text in another cell Newbie Bob Excel Discussion (Misc queries) 2 October 25th 05 01:23 AM


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