Auto Numbering based on 2 columns value.

bentxoxo

New Member
Joined
Jan 13, 2016
Messages
29
Hi All,

Can someone please help me on below formula.

I am trying to add +1 if order number and store number (any one) value are different but if both values are same just use above number.

=IF(OR(C3=C2, B3=B2), A2, IF(OR(C3<>C2, B3<>B2), A2+1))

RA NAME PO
4525 ABC 2001
4525 ABC 2001
4526 DEF 3045
4527 DEF 3048
4528 GHI 1908
4527 JKL 1702
4527 JKL 1702
4528 MNO 1909
4528 MNO 1909
4528 MNO 1909
4528 MNO 1909

Cheers,
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
RANAMEPO
4525ABC2001
4525ABC2001
4526DEF3045
4527DEF3048
4528GHI1908
4529JKL1702
4529JKL1702
4530MNO1909
4530MNO1909
4530MNO1909
4530MNO1909

<colgroup><col width="72" span="3" style="width:54pt"> </colgroup><tbody>
</tbody>
A3=if(and(c3=c2, b3=b2), a2, if(or(c3<>c2, b3<>b2),a2+1))
 
Upvote 0

Book1
ABC
1RA NAMEPO
24525ABC2001
34525ABC2001
44526DEF3045
54527DEF3048
64528GHI1908
74529JKL1702
84529JKL1702
94530MNO1909
104530MNO1909
114530MNO1909
124530MNO1909
Sheet1
Cell Formulas
RangeFormula
A3=IF(COUNTIFS(B$2:B3,B3,C$2:C3,C3)-1,A2,A2+1)
 
Upvote 0
Hi Mohadin, Nishant94,

Thank you for your reply.
@Nishant94, Just a small change if possible! Company name always be there which is column "B" but some time if I don't have PO number. So if PO number column "C" is empty it should add +1 because company name is not matching with the last one. Please see below.

RA NAME PO RESULT
4525 ABC 2001 4525
4525 ABC 2001 4525
4526 DEF 3045 4526
4527 DEF 3048 4527
4528 GHI 1908 4528
4529 JKL 1702 4529
4529 JKL 1702 4529
4530 MNO 1909 4530
4530 MNO 1909 4530
4530 MNO 1909 4530
4530 MNO 1909 4530
4530 PQR 4531
4531 STU B12345 4532
4531 STU B12345 4532
4532 VWX I443105 4533
4532 VWX I443105 4533
4533 YZA A930305 4534
4534 YZA 1909 4535
4534 BCD 4536
4535 BCD G45841 4537
4536 STU X984532 4538

Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top