首页 \ 问答 \ Google电子表格根据其他人的价值查找单元格(Google spreadsheet look up cell based on value of other)

Google电子表格根据其他人的价值查找单元格(Google spreadsheet look up cell based on value of other)

我们试图使用这个电子表格 ,我将参考。

我试图让单元格X4显示列A中的数据,相对于单元格X3中显示的列B的最大值,即在写入时最大值列为27,这是通过“Purelycraft”完成的我希望它使用公式来自动显示名称“Purelycraft”,因为他杀死的最多。


The spreadsheet we are trying to use this on and I will be referencing.

I am trying to get cell X4 to display the data from column A relative to the max of column B as displayed in cell X3, ie at the time of writing this the maximum is listed as 27, which was done by "Purelycraft" and so I want it to use formulas to automatically display the name "Purelycraft" as he has the most kills.


原文:https://stackoverflow.com/questions/20959318
更新时间:2022-01-27 19:01

最满意答案

这是我在网上找到的一个很酷的正则表达式。 它以几乎任何美国格式验证一个数字并将其转换为(xxx)xxx-xxxx。 我认为这很好,因为那时人们可以使用他们习惯使用的任何格式输入任何10位数字的美国电话号码,并从中得到格式正确的号码。

以下是您可以放入MY_form_validation类的全部功能。 我希望我的表单允许空字段,所以如果你想强制一个值,你必须改变它。

function valid_phone_number_or_empty($value)
{
    $value = trim($value);
    if ($value == '') {
        return TRUE;
    }
    else
    {
        if (preg_match('/^\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/', $value))
        {
            return preg_replace('/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/', '($1) $2-$3', $value);
        }
        else
        {
            return FALSE;
        }
    }
}

Here's a cool regex I found out on the web. It validates a number in almost any US format and converts it to (xxx) xxx-xxxx. I think it's great because then people can enter any 10 digit US phone number using whatever format they are used to using and you get a correctly formatted number out of it.

Here's the whole function you can drop into your MY_form_validation class. I wanted my form to allow empty fields so you'll have to alter it if you want to force a value.

function valid_phone_number_or_empty($value)
{
    $value = trim($value);
    if ($value == '') {
        return TRUE;
    }
    else
    {
        if (preg_match('/^\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/', $value))
        {
            return preg_replace('/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/', '($1) $2-$3', $value);
        }
        else
        {
            return FALSE;
        }
    }
}

相关问答

更多