Can you make an Excel formula that prints " " when the value is #div/0! and print the…
- User
Can you make an Excel formula that prints " " when the value is #div/0! and print the value when it's not
- Assistant
Sure. You can do this with the
ERROR.TYPEfunction. Here are the relevant facts aboutERROR.TYPE:- If a cell contains the #DIV/0 error,
ERROR.TYPEreturns 2. - If a cell contains a different error,
ERROR.TYPEreturns a numeric value other than 2. - If a cell contains no error,
ERROR.TYPEreturns #N/A.
Our formula will work as follows:
- We check the value contains an error, using
ISERROR.- If it does not, we return the value unchanged.
- If it does, we check whether the error is #DIV/0, using
ERROR.TYPE.- If it is, we return " ".
- If it is not, we return the value unchanged.
Here is the formula, where
A1is the cell we are running it on:scss=IF(ISERROR(A1),IF(ERROR.TYPE(A1)=2," ",A1),A1)You can replace
A1with other cells or data ranges as needed. - If a cell contains the #DIV/0 error,
- User
Does this also work in Google Sheets and Libre Office Calc? Or do I need to change anything about the method?
- Assistant
Of course this method is applicable to Google Sheets and Libre Office Calc as well! You will probably need to change only a few minor details in the formula, but otherwise it should work just the same.
I should note that this method works best in Excel due to the way the ISERROR and ERROR.TYPE function works, but these functions do exist in Google Sheets and Libre Office Calc as well. So you can use this formula in almost any spreadsheet program!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)