首页 \ 问答 \ 如何使用公式计算excel [Range]中的数字出现次数?(How to count a number occurence in an excel [Range] using formula?)

如何使用公式计算excel [Range]中的数字出现次数?(How to count a number occurence in an excel [Range] using formula?)

我使用这个公式=SUM( --ISNUMBER( FIND( number, Range, 1 ) ) )来计算一行中出现的次数,但正如您在行中的示例图像中看到的那样, Col D突出显示它不再计算同一单元格中的相同数字。 PrintScreen- 示例图像链接


I used this formula =SUM( --ISNUMBER( FIND( number, Range, 1 ) ) ) to count how many times a number occurred in a row, but as you can see in the sample image in the row 2 Col D the highlighted it doesn't count again the same number in the same cell. PrintScreen- Sample Image Link


原文:https://stackoverflow.com/questions/26247573
更新时间:2022-08-25 08:08

最满意答案

对于登录屏幕任务,如存储用户名和密码,您可以使用共享首选项。 在这里我已经制定了使用共享偏好的自定义方法。 调用savePreferences()方法并将你的Key和Value(因为savePreferences()基于XML),同样用你的Key调用Load。 最后,不要忘记在LOGOUT上调用deletePreferences()

/**
 *   Method used to get Shared Preferences */

public SharedPreferences getPreferences() 
{
    return getSharedPreferences(<PREFRENCE_FILE_NAME>, MODE_PRIVATE);
}
/**
 *  Method used to save Preferences */
public void savePreferences(String key, String value) 
{
    SharedPreferences sharedPreferences = getPreferences();
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putString(key, value);
    editor.commit();
}
/**
 *  Method used to load Preferences */
public String loadPreferences(String key) 
{
    try {
        SharedPreferences sharedPreferences = getPreferences();
        String strSavedMemo = sharedPreferences.getString(key, "");
        return strSavedMemo;
    } catch (NullPointerException nullPointerException) 
    {
        Log.e("Error caused at  TelaSketchUtin loadPreferences method",
                ">======>" + nullPointerException);
        return null;
    }
}
/**
 *  Method used to delete Preferences */
public boolean deletePreferences(String key)
{
    SharedPreferences.Editor editor=getPreferences().edit();
    editor.remove(key).commit();
    return false;
}

希望这可以帮助你。 不要忘记做+1。


For Login screen tasks like storing username and password you can use Shared Preferences. Here I had made custom methods for using shared preferences. Call savePreferences() method and put your Key and Value(as savePreferences() is based on XML), similarly call Load with your Key. And lastly don't forgot to call deletePreferences() on LOGOUT.

/**
 *   Method used to get Shared Preferences */

public SharedPreferences getPreferences() 
{
    return getSharedPreferences(<PREFRENCE_FILE_NAME>, MODE_PRIVATE);
}
/**
 *  Method used to save Preferences */
public void savePreferences(String key, String value) 
{
    SharedPreferences sharedPreferences = getPreferences();
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putString(key, value);
    editor.commit();
}
/**
 *  Method used to load Preferences */
public String loadPreferences(String key) 
{
    try {
        SharedPreferences sharedPreferences = getPreferences();
        String strSavedMemo = sharedPreferences.getString(key, "");
        return strSavedMemo;
    } catch (NullPointerException nullPointerException) 
    {
        Log.e("Error caused at  TelaSketchUtin loadPreferences method",
                ">======>" + nullPointerException);
        return null;
    }
}
/**
 *  Method used to delete Preferences */
public boolean deletePreferences(String key)
{
    SharedPreferences.Editor editor=getPreferences().edit();
    editor.remove(key).commit();
    return false;
}

Hope this should help you. Don't Forget to do +1.

相关问答

更多
  • 尝试contains(String key)适应Javadocs, 检查首选项是否包含首选项。 如果首选项中存在首选项,则返回true,否则返回false。 Try contains(String key) Accorting to the Javadocs, Checks whether the preferences contains a preference. Returns true if the preference exists in the preferences, otherwise fal ...
  • 无论如何,如果您依赖于某些关键值,检查偏好文件的存在是一个好主意。 It is a good idea to check for the preference file existence anyway if you depend on certain critical values.
  • 这是一个非常好的教程,可以回答您的问题 http://saigeethamn.blogspot.de/2009/10/shared-preferences-android-developer.html Here is a very good tutorial that answers your questions http://saigeethamn.blogspot.de/2009/10/shared-preferences-android-developer.html
  • 您正在尝试将布尔值true和false值存储为字符串。 这意味着您只能有两个可能的字符串,“true”和“false”。 设置类型容器只存储唯一值 - 没有重复项。 因此,在您的集合中,您将只有两个不同的值,“true”和“false”。 如果要存储列表,可能需要以某种方式将其转换为字符串,以便保留实际值和顺序。 然后在读取该值时,解析该字符串以重建该列表。 You're trying to store boolean true and false values as strings. This means ...
  • 对于登录屏幕任务,如存储用户名和密码,您可以使用共享首选项。 在这里我已经制定了使用共享偏好的自定义方法。 调用savePreferences()方法并将你的Key和Value(因为savePreferences()基于XML),同样用你的Key调用Load。 最后,不要忘记在LOGOUT上调用deletePreferences() 。 /** * Method used to get Shared Preferences */ public SharedPreferences getPrefere ...
  • SharedPreferences存储在设备上,如果您更新应用程序,则保留在那里。 存储在那里的键/值对如果在代码中更改键,则不会自动更新键。 另一方面,卸载应用程序将删除每个应用程序设置,即您的SharedPreferences 。 如果较新的版本查找使用新密钥存储的数据,则如果它与旧密钥一起存储将无法找到任何内容,并且将返回null 。 这很可能是您遇到的NPE。 您可以检查两个密钥(如果存在,则更喜欢新密钥)并保持与旧版本的兼容性。 除此之外,您应始终期望获得null并以安全的方式处理它,因为用户可以 ...
  • 如果用户通过设置清理数据,那么它是完全真实的,那么共享首选项中的所有数据都会消失 Android为您提供了几个选项来保存持久的应用程序数据。 您选择的解决方案取决于您的特定需求,例如数据是否应该专用于您的应用程序或可供其他应用程序(和用户)访问以及数据需要多少空间。 您的数据存储选项如下: 共享首选项将私有原始数据存储在键值对中。 内部存储将私人数据存储在设备内存上。 外部存储将公共数据存储在共享外部存储上。 SQLite数据库将结构化数据存储在私有数据库中。 网络连接使用您自己的网络服务器将数据存储在网络 ...
  • 从这个问题重复我的回答 ...... 检索: var prefs = Application.Context.GetSharedPreferences("MyApp", FileCreationMode.Private); var somePref = prefs.GetString("PrefName", null); 商店: var prefEditor = prefs.Edit(); prefEditor.PutString("PrefName", "Some value"); prefEdit ...
  • 空字符串仍然是一个字符串(而String("") != null将返回true)。 试试这个: if(!strJson.equals("")) 这假设空字符串首先不会是您的SharedPreferences中的有效输入。 An empty string is still a string (and String("") != null will return true). Try this instead: if(!strJson.equals("")) This assumes the empty ...
  • 在线有错误: editor.remove("deviceId" + String.valueOf(deviceid)); 它应该是 editor.remove("deviceId" + String.valueOf(index)); 也许您还想删除deviceSize键: editor.remove("deviceSize"); 在提交之前。 你的代码不是很清楚。 使其更具可读性。 There is mistake on line : editor.remove("deviceId" + Strin ...

相关文章

更多

最新问答

更多
  • python的访问器方法有哪些
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。
  • 响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
  • 在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
  • NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
  • 元素上的盒子阴影行为(box-shadow behaviour on elements)
  • Laravel检查是否存在记录(Laravel Checking If a Record Exists)
  • 设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
  • 想学Linux 运维 深圳有哪个培训机构好一点
  • 为什么有时不需要在lambda中捕获一个常量变量?(Why is a const variable sometimes not required to be captured in a lambda?)
  • 在Framework 3.5中使用服务器标签<%=%>设置Visible属性(Set Visible property with server tag <%= %> in Framework 3.5)
  • AdoNetAppender中的log4net连接类型无效(log4net connection type invalid in AdoNetAppender)
  • 错误:发送后无法设置标题。(Error: Can't set headers after they are sent. authentication system)
  • 等待EC2实例重启(Wait for an EC2 instance to reboot)
  • 如何在红宝石中使用正则表达式?(How to do this in regex in ruby?)
  • 使用鼠标在OpenGL GLUT中绘制多边形(Draw a polygon in OpenGL GLUT with mouse)
  • 江民杀毒软件的KSysnon.sys模块是什么东西?
  • 处理器在传递到add_xpath()或add_value()时调用了什么顺序?(What order are processors called when passed into add_xpath() or add_value()?)
  • sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
  • 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
  • AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
  • SQL查询,其中字段不包含$ x(SQL Query Where Field DOES NOT Contain $x)
  • PerSession与PerCall(PerSession vs. PerCall)
  • C#:有两个构造函数的对象:如何限制哪些属性设置在一起?(C#: Object having two constructors: how to limit which properties are set together?)
  • 平衡一个精灵(Balancing a sprite)
  • n2cms Asp.net在“文件”菜单上给出错误(文件管理器)(n2cms Asp.net give error on Files menu (File Manager))
  • Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
  • 湖北京山哪里有修平板计算机的