This is an Excel (or WPS) extension function that calculates the difference of the station (that is, the length), which reduces the amount of work the engineer can do in the statistical work.
This function has a certain universality. Can be used on MS Office and Kingsoft WPS.
at the end of this article, we will give you a simple procedure for using this function Excel (or WPS for a more detailed description of the custom functions in here [1] .
Copy the following into the module and use the custom Zh_len function to calculate the length between the two stations after saving.
'function: Zh_len'effect: The difference between the end station (return number)'@ I'm just a little bird [email protected]'version: V1.0'Time: 2014.12.09FunctionZh_len (end station, starting station) Zh_len= Tonumber (End station)-Tonumber (starting station)End Function'remove non-digits from a string'a decimal or negative number is considered, but the station cannot handle two minus signsFunctionTonumber (C)DimTemp Temp="" fori =1 to Len(C)If IsNumeric(Mid(C, I,1)) =True ThenTemp= Temp &Mid(C, I,1) ElseIf Mid(C, I,1) ="." Then 'consider decimalsTemp = temp &Mid(C, I,1) ElseIf Mid(C, I,1) ="-" Then 'consider negative numbersTemp ="-" End If NextI tonumber=TempEnd Function
Description: -----
1. In fact, this function can calculate the difference between any two numbers of strings with numbers;
2. Can handle the decimal, with 1 minus the two special stations, but can not accurately identify the station with 2 minus sign. Of course, the 2 minus sign of the station is very counter-day, is unlikely to appear.
3. Grant Hengsheng run, and in Excel allow all macros to run and reopen.
Simple Steps (in WPS as an example):
Open WPS, click Development Tools >>VB Editor → insert an empty module → Paste the code into the module, save, close the VB editor → use a custom function in the table |
Step 1 Open WPS and click on the development tool >>VB editor.
Step 2 Inserts an empty module.
Step 3 Paste the function into the module, save and close the VB Editor.
Step 4 uses the custom function in the table.
-----
[1]http://blog.sina.com.cn/s/blog_638f98570101fbqn.html
-----
If you believe that this article is helpful to your work or study, please support (comment, reprint or share) the author to give him the impetus to continue writing. If you have any questions, please contact [email protected] to communicate.
-----
Copyright notice: This article by @ I was just a little bird creation, licensed under the Creative Commons Attribution-NonCommercial use-no derivative of the 3.0 Chinese mainland license agreement. Unless noted, are original articles, reproduced please specify: Reproduced from this is only a small bird's nest, and retain this paragraph statement. This address: http://blog.sina.com.cn/s/blog_638f98570102vfet.html
Publish an Excel Custom Function (VBA) that calculates the difference of the station number