Formula to populate number in one column based on conditions in other columns

LtCmdrData

Board Regular
Joined
Jan 24, 2018
Messages
58
Office Version
  1. 365
Platform
  1. Windows
I am trying to write a formula I can drag down a column so it will populate a series of numbers based on conditions in another column. I always start with "1" in the first cell (R2 because I have a column heading in R1). If column Q has data then repeat "1" in R3. If Q3 is blank then leave R3 blank. If Q4 has data then populate R4 with "2" and so on. Here is an example of what my data looks like. I think an IF or IFS statement would work? Can someone please help me write this formula? Thank you.


1656000582583.png
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Please update your profile to indicate which version of Excel you are using and please try to use XL2BB to post sample data.

What about:

Book1
QR
1Heading1Heading2
2USA1
3USA2
4 
5USA3
6 
7USA4
8 
9USA5
10 
11USA6
12USA7
13 
14ABC8
15ABC9
16ABC10
Sheet1
Cell Formulas
RangeFormula
R2:R16R2=IF(""=Q2,"",1+MAX($R$1:R1))
 
Last edited:
Upvote 0
I have something similar with a little extra

Excel Formula:
=IF($Q2="","",IF(AND(R1<>"",R1<>$R$1),R1,IFERROR(MAX($R$1:$R1),0)+1))
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Another option
Fluff.xlsm
QR
1Heading1Heading2
2USA1
3USA1
4 
5USA2
6 
7USA3
8 
9USA4
10 
11USA5
12USA5
13 
14USA6
15USA6
16USA6
Data
Cell Formulas
RangeFormula
R3:R16R3=IF(Q3="","",IF(Q2="",MAX(R$1:R2)+1,R2))
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Another option
Fluff.xlsm
QR
1Heading1Heading2
2USA1
3USA1
4 
5USA2
6 
7USA3
8 
9USA4
10 
11USA5
12USA5
13 
14USA6
15USA6
16USA6
Data
Cell Formulas
RangeFormula
R3:R16R3=IF(Q3="","",IF(Q2="",MAX(R$1:R2)+1,R2))
Thanks Fluff, you came thru for me once again. I updated my profile as you suggested. Thanks again!
 
Upvote 0
Glad we could help & thanks for the feedback.

Thanks also for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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