Creating a loop to fill data?

imsyun

New Member
Joined
Jun 29, 2022
Messages
9
Office Version
  1. 365
Platform
  1. MacOS
Hi all, I've been tasked to clean a dataset and prepare it for SPSS which doesn't handle blank rows well. The dataset looks something like this:
93bKVT.jpg


Basically, there are people visiting each with their own ID and each row is a visit. I have to copy the DOB, sex, and calculate age at time of visit for each person. So something like the image below which I've been doing manually. There are also random gaps throughout because of other data.

p98TjB.jpg

However, the task is very repetitive, especially with so much data. I'm sure there's a faster way to do it but I'm not sure how. I tried searching online but I haven't had much luck, probably because I don't know how to describe the issue.

I would appreciate any tips or what I should be searching to find possible solutions. Thanks!
 
You are welcome.
Glad I was able to help!
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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