如何在单个单元格中找到最高和最低值 [英] How to find the highest and lowest values in a single cell

查看:87
本文介绍了如何在单个单元格中找到最高和最低值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找单个单元格的最高和最低值.

I am trying to find the highest and lowest values of a single cell.

字符串有很多变化

E9单元格

a)63Ra b)64Ra c)65Ra d)62Ra e)61Ra f)63Ra g)60Ra h)62Ra

单元格E10

a)45° b)44.5° c)45° d)45° e)45.2° f)44.7°

单元格E11

a)Ø14.290 b)Ø14.286 c)Ø14.283

单元格F9> 65

单元格G9> 60

单元格F10> 44.5

Cell F10 > 44.5

单元格G10> 45.2

Cell G10 > 45.2

单元格F11> 14.290

Cell F11 > 14.290

单元格G11> 14.283

Cell G11 > 14.283

我发现了类似的问题,但是我不确定如何根据自己的需要调整公式. 从字符串中提取最大数目

I found a similar problem but I am not sure how to tweak the formula to my needs. Extract maximum number from a string

推荐答案

尝试使用此vba代码

 Option Explicit
Sub cut_my_number_Please()
Dim reg As Object
Dim MY_match
Dim Matches
Dim my_max As Double: my_max = -1
Dim i%, lr%: lr = Cells(Rows.Count, 5).End(3).Row
Dim k%: k = 6
Union(Range("D9:D50"), Range("F9:R50")).ClearContents
Set reg = CreateObject("VBscript.RegExp")
With reg
.Pattern = "([\d\.]+)"
.Global = True
End With
 For i = 9 To lr
    If reg.test(Range("E" & i)) Then
      Set Matches = reg.Execute(Range("E" & i))
       For Each MY_match In Matches
         Cells(i, k) = MY_match * 1
         If MY_match * 1 >= my_max Then my_max = MY_match * 1
        k = k + 1
       Next
    End If
     Cells(i, "D") = my_max
     my_max = -1
      k = 6
 Next i
End Sub

这篇关于如何在单个单元格中找到最高和最低值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆