我的电子表格中有一个列是一个名单列表,我想计算一个名字出现在该列表中的频率..我搜索了很多,发现我应该使用“= COUNTIF(A:A, “John Doe”),但这让我解析错误..
基本上,我有一个这样的列表:
public class AddPatientActivity extends AppCompatActivity implements View.OnClickListener{
private static final int DATE_DIALOG_ID = R.layout.birthdaypicker;
private EditText editTextName;
private EditText editTextBirth;
private EditText editTextAge;
private EditText editTextComp;
private SimpleDateFormat dateFormat;
private Calendar c = Calendar.getInstance();
private Calendar now = Calendar.getInstance();
private Button buttonCalc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_patient);
editTextName = (EditText) findViewById(R.id.editTextName);
editTextAge = (EditText) findViewById(R.id.editTextAge);
editTextBirth = (EditText) findViewById(R.id.editTextBirth);
editTextComp = (EditText) findViewById(R.id.editTextComp);
buttonCalc = (Button) findViewById(R.id.buttonCalc);
buttonCalc.setOnClickListener(this);
dateFormat = new SimpleDateFormat("dd/MM/yyyy");
}
@Override
public void onClick(View view) {
//if calc button is pressed
if (view.getId() == R.id.buttonCalc) {
String date = editTextBirth.getText().toString();
try {
c.setTime(dateFormat.parse(date));
int age = now.get(Calendar.YEAR) - c.get(Calendar.YEAR);
if (now.get(Calendar.DAY_OF_YEAR) < c.get(Calendar.DAY_OF_YEAR)) {
age--;
}
String idade = Integer.toString(age);
editTextAge.setText(idade);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
我需要计算一下,名称出现在该列表中的频率,结果将是
John Doe
Jane Doe
Jane Doe
John Doe
John Doe
John Doe
Jane Doe
答案 0 :(得分:3)
我太蠢了:D
= COUNTIF(A:A;“John Doe”)带有“;”工作正常..我总是用“,”分开..