Using VLOOKUP to Copy Data In Row Where Cell Below Name is Blank

jrjobe

New Member
Joined
Feb 3, 2012
Messages
38
Office Version
  1. 365
  2. 2003 or older
Platform
  1. Windows
Good Evening!

I am using VLOOKUP to pull data from another sheet called "001A Hrs Summary" that contains data pulled from an external source. The problem I am running into is if the row on the "001A Hrs Summary sheet" that matches the VLOOKUP contains a blank cell directly below the name being looked up, then there is additional data in the second row, that belongs to the cell above it, that I need to populate next to the primary data in columns "J - Q" of the "001A Teams" sheet.

On the 001A Hrs Summary sheet, I highlighted the blank cells, which represents an individuals secondary qualification on an aircraft. The primary is what is listed directly across from their name, whereas one individual's primary (1st qual) may be AC2 another's primary may be AC1, and only if they have a secondary qualification will the 2nd row populate on the data sheet with a blank cell below their name.

In the sample below, Doe, John J. has a secondary qual (rows 8/9 of 001A Hrs Summary). It is that row, I am trying to populate in columns J - Q of the 001A Teams. The caveat to this is that the Hrs Summary is constantly updated by another office and names are constantly added and removed and quals added, so the rows Doe, John J. may be in today, may change tomorrow which is why I had to use VLOOKUP.

Is there any way to get the secondary qual to populate? If there is an easier way by automatically restructuring the Hrs Summary sheet, to possibly another sheet that will move the secondary next to the end of the primary line, I am open to it. I have been researching this tirelessly for days to no ends, and below is the best I could come up with.

Also, here is a link to the excel file on SkyDrive that I stripped down for security reasons. Columns A - Q are typically hidden.

I really appreciate any help I can get. I come here quite often when doing little projects that I get stumped on and this site has been a time saver.

Thanks again!

Excel 2010
ABCDEFGHIJKLMNOPQS
3Doe, John D.AC1185.169185.10000Doe, John D.
4Doe, John J.AC21951.17931851.1092.407.6Doe, John J.

<tbody>
</tbody>
001A Teams

Worksheet Formulas
CellFormula
A3=IF(S3="","",S3)
B3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
C3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
D3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
E3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
F3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
G3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
H3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
I3=IF($A3="","",VLOOKUP($A3,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
A4=IF(S4="","",S4)
B4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
C4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
D4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
E4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
F4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
G4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
H4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))
I4=IF($A4="","",VLOOKUP($A4,'001A Hrs Summary'!$B$1:$J$402,COLUMN(),FALSE))

<tbody>
</tbody>

<tbody>
</tbody>

Excel 2010
ABCDEFGHIJ
1DIVNameA/CTot. TimeflightsPrimarySecondaryInstructorEvaluatorOther
2001ADoe, John D.AC1185.169185.10000
3Total Hours185.169185.10000
4001ADoe, John A.AC2303.6117303.60000
5Total Hours303.6117303.60000
6001ADoe, John W.AC2360.2135360.20000
7Total Hours360.2135360.20000
8001ADoe, John J.AC21951.17931851.1092.407.6
9001AAC19643339610003
10Total Hours2915.111262812.1092.4010.6
11001ADoe, John Z.AC11069.5385984076.771.8
12001AAC2708.2286700.405.32.50
13Total Hours1777.76711684.40829.51.8
14001ADoe, John C.AC1423.6141423.60000
15Total Hours423.6141423.60000
16001ADoe, Johnny C.AC1926.7303925.50001.2
17001AAC2115.154115.10000
18Total Hours1041.83571040.60001.2
19001ADoe, John H.AC2521.6215521.60000
20Total Hours521.6215521.60000

<tbody>
</tbody>
001A Hrs Summary
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Your use of COLUMN() in your existing formulas is risky. Say you decide to insert an extra column at the left of the '001A Teams' sheet, all your formulas will return incorrect results. Try it in a copy of your workbook. So as well as suggesting how you can get the second row of data, I'm also suggesting a more robust way to get the first row.

It would be possible to do this task with formulas in columns B:Q only, but those formulas for the second row of data (columns J:Q) would be pretty complex.
Instead, I'm suggesting using two helper columns in the '0011A Teams' sheet as shown. I've used columns T:U but they could be any available columns and they could be hidden if you want after populating the formulas. Using the helper columns keeps all the formulas pretty simple.

Formula in B3 is copied across to column I and then down.
Formula in J3 is copied across to column Q and then down.
Formulas in T3 and U3 are just copied down.

Obviously you would have to change the $20 references in my formulas to cover all the rows of data in the '001A Hrs Summary' sheet.

Excel Workbook
ABCDEFGHIJKLMNOPQRSTU
1A/CTot. TimeflightsPrimarySecondaryInstructorEvaluatorOtherA/CTot. TimeflightsPrimarySecondaryInstructorEvaluatorOtherRow 1Row 2
2
3Doe, John D.AC1185.169185.10000 Doe, John D.1 
4Doe, John A.AC2303.6117303.60000Doe, John A.3
5Doe, John W.AC2360.2135360.20000Doe, John W.5
6Doe, John J.AC21951.17931851.1092.407.6AC1360.2135360.20000Doe, John J.78
7Doe, John Z.AC11069.5385984076.771.8AC2360.2135360.20000Doe, John Z.1011
8Doe, John C.AC1423.6141423.60000Doe, John C.13
9Doe, Johnny C.AC1926.7303925.50001.2AC29643339610003Doe, Johnny C.1516
10Doe, John H.AC2521.6215521.60000Doe, John H.18
11
001A Teams
 
Last edited:
Upvote 0
Solution
Peter,

Thank you very much for your help! It works the way I have been trying to do for a while now. The only reason I was using COLUMN() was because I knew once the data was in there, there would be no need to add any columns to the left of the sheet and those columns would be locked and hidden from others. Any columns that would be added, are added to the right of column "Q". Columns B:Q are only being used so I could get the external data to be used elsewhere in the sheet. Using INDEX() is so much better - now that I understand how it's used. I thought of using a helper column but I couldn't figure out to do it.

If there was or is a way to contribute to you, I will. You are awesome and have saved me and my colleagues a lot of time.


Thanks again, Josh
 
Upvote 0
Thank you Sir! I should have restated it in a different way to show my gratitude. I have been trying to figure this out for a couple months. I sat down a few days ago to take another stab at it, and got to where I did before finally asking for help. I just wanted to express how thankful I am for your help. Definitely wasn't meaning to break board rules.


Josh
 
Upvote 0
Thank you Sir! I should have restated it in a different way to show my gratitude. I have been trying to figure this out for a couple months. I sat down a few days ago to take another stab at it, and got to where I did before finally asking for help. I just wanted to express how thankful I am for your help. Definitely wasn't meaning to break board rules.


Josh
No problem, sorry if I misinterpreted your previous post.
Your thanks in a post like you have done is all that is required in this forum. :)
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,187
Members
449,090
Latest member
bes000

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