我在 Excel 中有一个表,其中包含列和行标题以及相应的值。如何在 Excel 中按表中的值查找列和行标题名称/索引?
在 Mathematica 中,等效函数是 Position[listoflist,value]
编辑:
我在 VBA 中做了一个简单的函数,但这远非完美
Function MathematicaPosition(lookvalue As Range, TableRange As Range, RowOrColumn As Boolean) As Integer
Dim r As Integer
Dim c As Integer
Dim tempindex As Integer
Dim i As Integer, j As Integer
tempindex = 0
r = TableRange.Rows.Count
c = TableRange.Columns.Count
For i = 1 To r
For j = 1 To c
If lookvalue.Value = TableRange.Cells(i, j).Value Then
tempindex = IIf(RowOrColumn, i, j)
End If
Next j
Next i
MathematicaPosition = tempindex
End Function