Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have 4 columns with names, in some rows are none to 4 names. The names
appear random in any of the columns. It could look like this: name1 name2 name3 name 4 name5 I want to get the first name that appears (from left to right) and put it in the fifth column, like this: name1 name3 name4 I can't figure it out, any help is welcome |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
One way
'======= Option Explicit Sub getleftmostcell() Dim lr As Long Dim i As Long 'finds last row lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _ , , , xlByRows, xlPrevious).Row 'gets cell For i = 1 To lr If Len(Application.Trim(Cells(i, 1))) 0 Then Cells(i, 5) = Cells(i, 1) Else Cells(i, 5) = Cells(i, 1).End(xlToRight) End If Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Hans" wrote in message ... I have 4 columns with names, in some rows are none to 4 names. The names appear random in any of the columns. It could look like this: name1 name2 name3 name 4 name5 I want to get the first name that appears (from left to right) and put it in the fifth column, like this: name1 name3 name4 I can't figure it out, any help is welcome |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Assuming the data is in columns A thru D...
=IF(LEN(A1)<0,A1,IF(LEN(B1)<0,B1,IF(LEN(C1)<0,C 1,D1))) -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "Hans" wrote: I have 4 columns with names, in some rows are none to 4 names. The names appear random in any of the columns. It could look like this: name1 name2 name3 name 4 name5 I want to get the first name that appears (from left to right) and put it in the fifth column, like this: name1 name3 name4 I can't figure it out, any help is welcome |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
=IF(COUNTA(1:1),INDEX(1:1,MATCH("*",1:1,0)),"")
"Hans" wrote: I have 4 columns with names, in some rows are none to 4 names. The names appear random in any of the columns. It could look like this: name1 name2 name3 name 4 name5 I want to get the first name that appears (from left to right) and put it in the fifth column, like this: name1 name3 name4 I can't figure it out, any help is welcome |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting different strings of text | New Users to Excel | |||
Sorting (Numbers with Text) | Excel Discussion (Misc queries) | |||
help with text sorting | Excel Worksheet Functions | |||
Sorting Text | Excel Discussion (Misc queries) | |||
sorting of text | Excel Discussion (Misc queries) |