Add a number '1' next to highest number in column

M

Mally

Column A has numbers in it and some of these match.
Column B has numbers in it and some of these match.
The columns are already sorted by A then B.

What I need to do is where a number matches in column A, I need a number ‘1’
inserting in column C next to the highest number in column B. This needs to
be copied down the sheet.

A B C
1 1 5 1
2 1 2
3 1 1
4 2 3
5 3 2 1
6 3 2
7 3 2
8 4 3 1
9 4 2
10 4 2
11 4 2
12 4 1

As you can see in the example above if there is more than one number the
same in column B then only one ‘1’ needs to be inserted.

If there is only one unique number in column A then nothing needs to be
inserted in column C.

Thanks in advance for any help.
 
J

Jacob Skaria

Try this formula in C1...

=IF(ROW()=SUMPRODUCT(--($A$1:$A$100=A1),--($B$1:$B$100=MAX($B$1:$B$100)),--ROW($B$1:$B$100)),1,"")


If this post helps click Yes
 
M

Mally

Thanks for your help Jacob.

I got sorted by adding a few more columns and doing a sort
 
J

Jacob Skaria

Fine Mally..

However the below formula will assign 1 aganist the maximum value...

=IF(B1=SUMPRODUCT(MAX(($A$1:$A$100=A1)*($B$1:$B$100))),1,"")

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top