gpt4 book ai didi

excel - 如何将 "fraction"字符转换为十进制?

转载 作者:行者123 更新时间:2023-12-03 03:14:08 25 4
gpt4 key购买 nike

我有一个数据集,其数据格式如下:

10 ¾ AB 02/15/19

我正在尝试将 3/4 转换为 .75,以便数据如下所示:

10.75 AB 02/15/19

我正在考虑尝试迭代字符串中的每个字符,但是一旦这样做,如何将 3/4 转换为 .75

最佳答案

一组简单的字符串替换:

Public Function numerify(s As String) As String
numerify = Replace(s, " " & ChrW(190), ".75")
numerify = Replace(numerify, " " & ChrW(188), ".25")
numerify = Replace(numerify, " " & ChrW(189), ".5")
End Function

enter image description here

注释:

我们替换分数之前的空格以及分数以获得所需的结果。
您可能需要考虑其他统一代码“分数”。

关于excel - 如何将 "fraction"字符转换为十进制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54712134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com