我有作業表

我要填寫 G 列
我不知道該怎么辦這個問題
我想要的是 :
. 如果列 F 填充為 black ,則列 G 填充為 S
。如果 F 列用黃色填充,則 G 列用 M 填充
。如果 F 列填充為紅色,則 G 列填充為 XL
我用的是office 2010
uj5u.com熱心網友回復:
替換分隔符 (UDF)
- 在 中
Visual Basic Editor,將以下代碼復制到標準模塊中:
Option Explicit
Function ReplaceDelimited( _
ByVal SearchString As String, _
ByVal ReadSubStrings As String, _
ByVal WriteSubStrings As String, _
Optional ByVal Delimiter As String = ",") _
As String
On Error GoTo ClearError
Dim Rss() As String: Rss = Split(ReadSubStrings, Delimiter)
Dim mIndex As Variant: mIndex = Application.Match(SearchString, Rss, 0)
If IsNumeric(mIndex) Then
ReplaceDelimited = Split(WriteSubStrings, Delimiter)(mIndex - 1)
End If
ProcExit:
Exit Function
ClearError:
Resume ProcExit
End Function
在 中
Excel,對于這種特殊情況,在單元格中G2使用以下公式:=ReplaceDelimited(F2,C2,D2)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/321446.html
