`

Excel Records

阅读更多
Public Function CalcMoney(carType As Range, timeType As Range, carItems As Range, timeItems As Range, timeValue As Range, others As Range)
    Dim temp
    Dim unitValue
    Dim timeTemp
    
    '先匹配出车型的列index
   temp = Application.Match(carType, carItems, 0)
   
   '匹配出车型所对应的机油、机油格数据
   unitValue = Application.Index(others, 0, temp + 1)
   
   timeTemp = Application.Match(timeType, timeItems, 0)
   
   '计算总结果
   CalcMoney = Application.Sum(unitValue) + Application.Index(timeValue, timeTemp, temp)
   
   'CalcMoney = SUM(INDEX(C5:AF6,0,MATCH($A$22,C3:AF3,0)+1))+INDEX(C18:AF21,MATCH($B$22,$B$18:$B$21,0),MATCH($A$22,C3:AF3,0))
End Function

Sub calc()
    Dim result
    Dim carItems()
    Dim timeItems()
    Dim timeValue()
    Dim others()
    Dim carType
    Dim timeType
    
    timeType = Range("$B$22")
    carType = Range("$A$22")
   carItems = Range("C3:AF3")
   timeItems = Range("$B$18:$B$21")
   timeValue = Range("C18:AF21")
   others = Range("C5:AF6")
    
   result = CalcMoney(carType, timeType, carItems, timeItems, timeValue, others)
    
   MsgBox result
End Sub
分享到:
评论

相关推荐

    asp.net应用Excelpackage在服务端生成excel

    在ASP.NET开发中,我们经常需要将数据导出到Excel文件以便用户下载。在这个场景下,ExcelPackage库是一个非常实用的工具,它允许我们在服务端生成Excel文件,并且可以利用预先设计好的模板来快速填充数据,保持一致...

    excel高手详解excel高手excel高手excel高手

    #### 如何以进阶筛选命令筛选出“序号”为单数、双数、或者是任意间距值的records 使用高级筛选的自定义筛选条件,例如 `=MOD(A1,2)=0` 表示筛选出偶数序号的记录。 #### n2=sum(b2到m2)、n3=sum(b3到m3)、有没有...

    读取excel数据转换成为json数据,和把json数据生成到excel文件中

    json_data = df.to_json(orient='records') # 将JSON数据写入文件 with open('output.json', 'w') as f: f.write(json_data) ``` 接下来,我们将讨论如何将JSON数据生成到新的Excel文件中。首先,我们需要解析...

    MAC版的 excel to json

    json_data = df.to_json(orient='records') with open('output.json', 'w') as f: f.write(json_data) ``` - **JavaScript:** 如果你熟悉 JavaScript,可以使用 `xlsx` 和 `fs` 库: ```javascript const ...

    Excel2Json

    该函数支持多种输出格式,如'records'(每个行作为一个独立的Json对象)、'index'(包含索引的Json对象)和'columns'(包含列名的Json对象)。 4. **处理Json多格式**:"Excel2Json"特别提到支持Json的全格式,这...

    不安装EXCEL 直接导出EXCEL(CSV)

    var records = csv.GetRecords(); } ``` 3. **映射字段**:CSVHelper允许你定义字段到类属性的映射,以便更灵活地处理数据。 ```csharp public class YourDataType { [Name("ColumnNameInCSV")] public string ...

    poi分多个sheet导出excel

    在Java编程中,Apache POI库是一个非常实用的工具,用于读取、写入和修改Microsoft Office格式的文件,特别是Excel(.xlsx)文件。在处理大量数据时,如果需要将数据导出到Excel,可能会遇到单个工作表(sheet)无法...

    excel文件转成json

    df.to_json(json_file, orient='records') excel_to_json('your_excel_file.xlsx', 'output.json') ``` 2. 在线转换工具:如果你不熟悉编程,也可以使用在线转换工具,如Zamzar、FileZigZag等。只需上传Excel文件...

    EXCEL表格转Json代码

    json_data = df.to_json(orient='records') ``` - VBA宏示例:在Excel中编写VBA代码,通过Workbook.SaveAs方法将数据导出为Json格式。 ```vba Sub ExcelToJson() Dim workbook As Workbook Set workbook = ...

    关于Excel变为JSON.zip

    json_data = excel_file.to_json(orient='records') ``` 4. 写入JSON文件到桌面: ```python with open('C:\\Users\\YourUsername\\Desktop\\output.json', 'w') as f: json.dump(json_data, f) ``` 在这个过程中,...

    delphi 运用EXCEL报表统计

    当涉及到数据报表的处理和统计时,Delphi开发者经常利用Microsoft Excel的功能,因为Excel提供了丰富的数据可视化和分析工具。本文将深入探讨如何在Delphi项目中运用Excel进行报表统计。 首先,为了在Delphi程序中...

    excel 导出为json

    json_data = df.to_dict(orient='records') # 保存为JSON文件 with open('excelData.json', 'w') as f: json.dump(json_data, f, ensure_ascii=False, indent=4) ``` 在上述代码中,`pd.read_excel()`读取Excel...

    Number of shape does not match the number of table records解决方法

    7. **保存更改**:由于`.dbf`文件格式限制,无法直接保存修改,可以将修改后的`.dbf`文件另存为Excel格式,再从Excel格式导出为新的`.dbf`文件。 8. **替换原有`.dbf`文件**:删除原有的`.dbf`文件,并用新导出的...

    excel/csv数据读取

    var records = csv.GetRecords(); // 处理数据... } ``` 在CSVIMPDemo这个项目中,可能包含了一个示例,演示了如何在C#环境中读取和处理CSV数据。实际应用中,你可以根据项目需求选择合适的方法,考虑性能、...

    使用ADO Recordset对象导入Excel).txt

    - **记录(Records)**:表示数据表中的行,可以通过`MoveFirst`、`MoveLast`、`MoveNext`、`MovePrevious`等方法移动指针位置。 #### 3. 将数据导入Excel的步骤 接下来,我们将通过具体的示例代码,展示如何使用`...

    python excel文件数据转成json

    本话题将详细讲解如何利用Python将Excel文件中的数据转换为JSON格式,这对于开发者来说是非常实用的技能,尤其是在处理结构化数据时。 Excel是一种广泛使用的电子表格应用程序,它允许用户组织、计算和存储数据。...

    excel 转 json

    json_data = excel_file.to_json(orient='records') # 将JSON数据写入文件 with open('output.json', 'w') as f: json.dump(json_data, f) ``` 这段代码中,`pd.read_excel()`函数用于读取Excel文件,返回一个...

    excel批量导入数据

    cursor.executemany(sql, batch_data.to_dict('records')) ``` 这里的'your_table'应替换为你的目标数据库表名。 最后,别忘了提交事务并关闭数据库连接: ```python connection.commit() cursor.close() ...

    java利用jxl导入Excel表格并保存到本地数据库

    List<DataRecord> records = reader.readExcel("path_to_your_excel_file"); DBUtil.executeBatch(records); } ``` 最后,描述中提到的"QQ截图20171205105348.png"可能是示例Excel文件的截图,"readExcel"可能是...

Global site tag (gtag.js) - Google Analytics