答案 0 :(得分:2)
我认为一个简单的if()
公式会对此有所帮助。
将以下内容粘贴在H4(您的第一个孩子)中并复制
=IF(LEFT(F3, 4)="PARE", F3, IF(LEFT(F4, 4)="PARE", "", H3))
示例:
答案 1 :(得分:0)
使用VBA,这将起作用:
Sub foo()
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
'declare and set your worksheet, amend as required
LastRow = ws.Cells(ws.Rows.Count, "F").End(xlUp).Row
'get the last row with data on Column F
For i = 1 To LastRow 'loop from row 1 to last
If Not IsNumeric(ws.Cells(i, 6).Value) Then 'check if value is numeric in column 6 = Column F
ParentValue = ws.Cells(i, 6) 'if is not a number then it is a parent
Else
ws.Cells(i, 8).Value = ParentValue 'add parent on column 8 = column H
End If
Next i
End Sub