# Formula to identify first value with 1, others with 0

##### New Member
I need to add a column to count the number of orders. Report is sorted by order number.

For the first instance of the order, I need a value of 1. For lines with the same order number, I need a 0. Having the 1 or 0 will allow me to count the unique orders and display on a pivot table.

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
say data is in B2 down.

in A2 put

=IF(COUNTIF(\$B\$2:B2,B2)=1,1,0)

Report is sorted by order number.

Hi, if that's the case this might be sufficient and efficient.

Excel 2013
AB
1Order #Formula
211
310
410
521
620
731
830
930
1041
1140
1240
1340
1451
1550
1661
1760
1860
Sheet1
Cell Formulas
RangeFormula
B2=IF(A2=A1,0,1)

Happy holidays:

I assumed your tracking column is A.
The first order will always be the first unique so A1 = 1 shouldn't cause any problems
All subsequent rows (I assumed 1000 rows) should examine column B on same row and compare it to B on previous row.

A1 =1
A2:A1000 = if(b2=b1,0,1)

Replies
3
Views
299
Replies
6
Views
289
Replies
5
Views
337
Replies
2
Views
305
Replies
23
Views
2K

1,196,213
Messages
6,014,032
Members
441,801
Latest member
Aneurysm

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back