Excel Formula Question

pr50

New Member
Joined
Aug 16, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to figure out a formula that would look at the data in A and B and produce C.

Basically, if A2 and B2 are different than A3 and B3, then C3 would increase by 1. Once A changes to a new value, the count on C would start over.

I hope this makes sense. Any help would be greatly appreciated!!


Screenshot_20230816_212404_Sheets.jpg
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this?
Book6
ABC
2redA1
3redB2
4blueA1
5blueB2
6blueB2
7blueB2
8blueC3
9yellowA1
10yellowB2
11yellowC3
12yellowD4
13yellowD4
Sheet1
Cell Formulas
RangeFormula
C2:C13C2=XMATCH(A2&B2,UNIQUE(FILTER($A$2:$A$13&$B$2:$B$13,$A$2:$A$13=A2)))
 
Upvote 0
Hi *pr5,
You can make cell C2 = 1 and put this formula in cell C3: =IF(A2<>A3, 1, C2 + IF(B2<>B3, 1, 0)) (Copy down)
The first if allow to reset the count to 1 in the column C whenever a new series start in column A.
Following the same process, if the series in column A continue, the second if allow to add 1 to the previous value in column C whenever the column B starts a new series.
Hope this can help.
 
Upvote 0
Welcome to the MrExcel board!

For the future I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

I think this fairly simple one also does what you want.

23 08 17.xlsm
ABC
1colorselectionresult
2redA1
3redB2
4blueA1
5blueB2
6blueB2
7blueB2
8blueC3
9yellowA1
10yellowB2
11yellowC3
12yellowD4
13yellowD4
pr50
Cell Formulas
RangeFormula
C2:C13C2=IF(A2=A1,C1+(B1<>B2),1)
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

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