Home » excel » excel – Formulas to populate spreadsheet with data

# excel – Formulas to populate spreadsheet with data

Questions:

I want to populate some cells given certain condition. The thing is, I have no idea how to do this with just formulas (can’t use macros or the sort).

Anyways, here’s my workbook, with its **sheets**:

``````**Sheet1**
Test     1
Test2    1
Test3    1
Test4    2
Test5    3
Test6    2
Test7

**Sheet2**
Week
2

Test4
Test6
``````

What I’ve been trying to do is:

• Populate Sheet2 tasks based on the week chosen.
• If I choose week #2 (in Sheet2), it should populate the task list (on the same sheet) with the tasks from Sheet1 that have that week number.

For example, right now it is (hypothetically) already loading tasks with a week == 2.

Any doubt, just let me know! I hope I made my issue clear.

Thank you very much in advance!

Okay, I found a better solution. This one requires an extra helper column on Sheet2, but it at least returns a compact list of matches (no weird spacing).

On Sheet2, in the first row of your list of matches (A3 in this example) enter the following:

``````=IFERROR(INDEX(Sheet1!\$A\$1:\$A\$7,B3),"")
``````

In the adjacent cell in the next column (B3 here) enter the following:

``````=IFERROR(MATCH(2,Sheet1!\$B\$1:\$B\$7,0),"")
``````

where 2 is the week # you are matching.

In the next row enter the following formulas (in A4 and B4 respectively):

``````=IFERROR(INDEX(OFFSET(Sheet1!\$A\$1:\$A\$7,SUM(B\$3:B3),0),B4),"")
``````

and

``````=IFERROR(MATCH(2,OFFSET(Sheet1!\$B\$1:\$B\$7,SUM(B\$3:B3),0),0),"")
``````

You can fill down this row of formulas as far as you like.

`=IF(Sheet1!B2:B8=2,Sheet1!A2:A8,"")`