If duplicate value then return just one value and put zero in the other one

Anonymous
2018-01-01T19:15:21+00:00

Hi everyone,

I'm using an if function to try to return one value and put zeros in the duplicated ones. However, I can't to this second step.

See the example:

As you can see on the yellow rows I have to repeated costs (3500) and 2 repeated capacity tons value (6). So I want to have only ONE cost (green one) and have a zero on the red cell instead of the 3500, IF the capacity tons is less or equal to 18 and times repeated is more than 2.

I didnt add the columns to the picture, so see them as A,B,C and rows 1,2,3 etc.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2018-01-01T20:03:54+00:00

    I'm embarrassed. Here is the next correction:

    =IF(NOT(AND(COUNTIF($B$2:$B2, B2)>1,D2<=18)),A2,0)

    4 people found this answer helpful.
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Anonymous
    2018-01-01T19:39:43+00:00

    This formula should do it for you. I'm assuming you want to look at repeat combinations of values in columns A and D:

    =IF(NOT(AND(COUNTIF($A$2:$A3, A3)>1,COUNTIF($D$2:$D3, D3)>1)),A3,0)

    0 comments No comments
  2. Anonymous
    2018-01-01T19:40:44+00:00

    That formula assumes it is in row 3. If you're starting in row 2, use this and copy down:

    =IF(NOT(AND(COUNTIF($A$2:$A2, A2)>1,COUNTIF($D$2:$D2, D2)>1)),A2,0)

    0 comments No comments
  3. Anonymous
    2018-01-01T19:56:13+00:00

    Hi Jason!

    It didn't work.

    I want to have the freight cost just once when the times repeated (column B) is more than two and the capacity tons (column D) is less or equal to 18.

    See the image below:

    See the green (correct answer)

    Thank you very much!!

    0 comments No comments
  4. Anonymous
    2018-01-01T20:01:41+00:00

    Sorry, I misunderstood. This should do it for you:

    =IF(NOT(AND(COUNTIF($A$2:$A2, A2)>1,D2<18)),A2,0)

    2 people found this answer helpful.
    0 comments No comments