formula to autofill with condition and skip blank cells

TheLSD

New Member
Joined
Jan 12, 2022
Messages
33
Office Version
  1. 2010
Platform
  1. Windows
I have the master sheet and data sheet (more than 1 but same format)

This is the example of the data from the sheet

ProjectDetails
Project A
Laptop
Printer
Camera
Blank
Phone
Projector
Project C
Implementation
Debug
Smart TV


what I need to do is to copy the project and skip the second column

if the project is blank then copy all the second column

but if the next first column contains words again, then copy and skip the second column

also, skip the blank rows and the formula able to accommodate more than one data sheets

expected outcome:

Project
Project A
Project B
Phone
Projector
Project C

I have the master sheet and data sheet (more than 1 but same format)

This is the example of the data from the sheet

ProjectDetails
Project A
Laptop
Printer
Camera
Blank
Phone
Projector
Project C
Implementation
Debug
Smart TV
what I need to do is to copy the project and skip the second column

if the project is blank then copy all the second column

but if the next first column contains words again, then copy and skip the second column

also, skip the blank rows and the formula able to accommodate more than one data sheets

expected outcome:

Project
Project A
Project B
Phone
Projector
Project C

the formula I use right now: =IF('Data1'!C7<>0;'Data1'!C7;'Data1'!E7)

the result from my formula:

Project
Project A
Laptop
Printer
Camera
0
0
Phone
Projector
0
Project C
Implementation
Debug
Smart TV

Note: the data rows are not always the same number with every data sheet (i.e. data1 100 rows, data2 400 rows, so on and I need the formula to work continuously through all the sheet (i.e. after the data from data1 finished, the formula move to data2, so on)

thank you
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
here with formulas and 2 named ranges but it can also be done in VBA
Map1
CDEFGHIJK
15Project
26Project A
37,1Laptop
48,1Printer
5ProjectDetails9,1Camera
6Project A11Blank
7Laptop12,1Phone
8Printer13,1Projector
9Camera15Project C
1016,1Implementation
11Blank17,1Debug
12Phone18,1Smart TV
13Projector#GETAL!-
14#GETAL!-
15Project C#GETAL!-
16Implementation#GETAL!-
17Debug#GETAL!-
18Smart TV#GETAL!-
19#GETAL!-
20#GETAL!-
21#GETAL!-
22#GETAL!-
23#GETAL!-
Blad1
Cell Formulas
RangeFormula
H1:H23H1=SMALL(IF(Project<>"",ROW(Project), IF(OFFSET(Project,,1,,)<>"",ROW(Project)+0.1,"")),ROW())
I1:I23I1=IF(ISNUMBER(H1),OFFSET(Project_Start,-ROW(Project_Start)+H1,H1<>TRUNC(H1),1,1),"-")
Named Ranges
NameRefers ToCells
Project_Start=Blad1!$D$5H1:I23
 
Upvote 0
here with formulas and 2 named ranges but it can also be done in VBA
Map1
CDEFGHIJK
15Project
26Project A
37,1Laptop
48,1Printer
5ProjectDetails9,1Camera
6Project A11Blank
7Laptop12,1Phone
8Printer13,1Projector
9Camera15Project C
1016,1Implementation
11Blank17,1Debug
12Phone18,1Smart TV
13Projector#GETAL!-
14#GETAL!-
15Project C#GETAL!-
16Implementation#GETAL!-
17Debug#GETAL!-
18Smart TV#GETAL!-
19#GETAL!-
20#GETAL!-
21#GETAL!-
22#GETAL!-
23#GETAL!-
Blad1
Cell Formulas
RangeFormula
H1:H23H1=SMALL(IF(Project<>"",ROW(Project), IF(OFFSET(Project,,1,,)<>"",ROW(Project)+0.1,"")),ROW())
I1:I23I1=IF(ISNUMBER(H1),OFFSET(Project_Start,-ROW(Project_Start)+H1,H1<>TRUNC(H1),1,1),"-")
Named Ranges
NameRefers ToCells
Project_Start=Blad1!$D$5H1:I23
Thank you for the answer, but if there's text inside column C, only copy the column C. But when column C blank, then move to column E and copy until its blank and go back to column C to copy if there's text there, but if not then continue copy from column E until its blank. Your answer works perfectly but it needs a little adjustment for my requirements.
But if you have any suggestions to tweak the table in order to meet my requirements, feel free to drop them!
If there's any update for it, do please give me. Appreciate it!
 
Upvote 0
1643943855636.png


Where did you get that highlighted value from?
 
Upvote 0
See if you could use something like this.
I have used column F in the data sheets as a helper column. It could be any column and it could be hidden once populated if you want.

22 02 04.xlsm
CDEF
54
6ProjectDetails0
7Project A1
8Laptop1
9Printer1
10Camera1
111
121
13Phone2
14Projector3
153
16Project C4
17Implementation4
18Debug4
19Smart TV4
204
Data1
Cell Formulas
RangeFormula
F5F5=MAX(F6:F20)
F7:F20F7=F6+AND(OR(C7<>"",INDEX(C$7:C7,AGGREGATE(14,6,(ROW(E$7:E7)-ROW(E$7)+1)/(E$7:E7=""),1))=""),LEN(C7&E7)>0)


22 02 04.xlsm
CDEF
510
6ProjectDetails4
7Project D5
8Item 15
95
10Item 26
11Item 37
12Item 48
138
14Project E9
15Item 59
16Item 69
179
18Item 710
1910
2010
Data2
Cell Formulas
RangeFormula
F5F5=MAX(F6:F20)
F6F6=Data1!F5
F7:F20F7=F6+AND(OR(C7<>"",INDEX(C$7:C7,AGGREGATE(14,6,(ROW(E$7:E7)-ROW(E$7)+1)/(E$7:E7=""),1))=""),LEN(C7&E7)>0)


Cell Formulas
RangeFormula
A2:A13A2=IFNA(INDEX(Data1!C$7:C$20&Data1!E$7:E$20,MATCH(ROWS(A$2:A2),Data1!F$7:F$20,0)),IFNA(INDEX(Data2!C$7:C$20&Data2!E$7:E$20,MATCH(ROWS(A$2:A2),Data2!F$7:F$20,0)),""))
 
Upvote 0
Solution
See if you could use something like this.
I have used column F in the data sheets as a helper column. It could be any column and it could be hidden once populated if you want.

22 02 04.xlsm
CDEF
54
6ProjectDetails0
7Project A1
8Laptop1
9Printer1
10Camera1
111
121
13Phone2
14Projector3
153
16Project C4
17Implementation4
18Debug4
19Smart TV4
204
Data1
Cell Formulas
RangeFormula
F5F5=MAX(F6:F20)
F7:F20F7=F6+AND(OR(C7<>"",INDEX(C$7:C7,AGGREGATE(14,6,(ROW(E$7:E7)-ROW(E$7)+1)/(E$7:E7=""),1))=""),LEN(C7&E7)>0)


22 02 04.xlsm
CDEF
510
6ProjectDetails4
7Project D5
8Item 15
95
10Item 26
11Item 37
12Item 48
138
14Project E9
15Item 59
16Item 69
179
18Item 710
1910
2010
Data2
Cell Formulas
RangeFormula
F5F5=MAX(F6:F20)
F6F6=Data1!F5
F7:F20F7=F6+AND(OR(C7<>"",INDEX(C$7:C7,AGGREGATE(14,6,(ROW(E$7:E7)-ROW(E$7)+1)/(E$7:E7=""),1))=""),LEN(C7&E7)>0)


Cell Formulas
RangeFormula
A2:A13A2=IFNA(INDEX(Data1!C$7:C$20&Data1!E$7:E$20,MATCH(ROWS(A$2:A2),Data1!F$7:F$20,0)),IFNA(INDEX(Data2!C$7:C$20&Data2!E$7:E$20,MATCH(ROWS(A$2:A2),Data2!F$7:F$20,0)),""))
OH MY GOD! YOU'RE A LIFESAVER SIR! THANK YOU VERY MUCH!
I mingle with this problem for about a week and thank God you answer what I need!
Truly, thank you
 
Upvote 0
You're welcome. Glad it works for you. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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