【发布时间】:2013-10-01 21:15:39
【问题描述】:
我在 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
【问题讨论】:
-
为什么删除了 Mathematica 标签?