-3

I have 5 cells with either 1, 0 and -1 values.

I want to build a formula that allows me to have, for example, a 0 or a -1 if any of those 5 cells are a 0 or a -1.

Can you please help? Thanks.

4
  • Can you elaborate your question? I'm currently not sure what you're asking. Some example data would also be helpful.
    – Jonno
    Commented Jan 8, 2016 at 16:15
  • Welcome to Super User. We are not a script writing service. We expect users to tell us what they have tried so far (including any scripts they are using) and where they're stuck so that we can help with specific problems. Questions that only ask for scripts are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?.
    – DavidPostill
    Commented Jan 8, 2016 at 16:17
  • You should also edit your question to include some example (mock) data (before and after). See Format Text as a Table for a web utility that will help you to create a nice data table you can paste into your question.
    – DavidPostill
    Commented Jan 8, 2016 at 16:17
  • What do you want if the 5 cells contain both a 0 and a -1?
    – fixer1234
    Commented Jan 8, 2016 at 19:53

1 Answer 1

0

To test for any zeros, use:

=IF(COUNTIF(A1:A5,0)>0,0,"")

and to test for any -1's, use:

=IF(COUNTIF(A1:A5,-1)>0,-1,"")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .