简体   繁体   中英

Excel - How to copy the content of certain cells based on the content of other cells

I work in education and wish to analyse results data according to pupils' individual characteristics.

My spreadsheet looks like this:
| A | B | C | D | E | F | G | H | IY | |Name |Class |Char A |Char B |Char C |Char D |Char E |Char F |Subjects | |Pupil 1 |Blue |M |Y |N |N |N |Y |Various | |Pupil 2 |Blue |F |N |Y |Y |N |Y |Results | |Pupil 3 |Blue |F |N |Y |N |N |Y | | |Pupil 4 |Blue |M |N |N |N |N |N | | ...
|Pupil 90|Yellow |M |Y |N |N |N |N | |

Columns I to Y contain the results for various subjects, shown as either a '1', a '2' or a '3'.

To start with, I wish to write a macro (or use Excel's formulae and functions if possible) to copy and paste the names of the pupils according to their characteristics into 7 separate tables in Sheet 2. Eg All male pupils as listed in Column C in one table, all female pupils as listed in Column C in a second, all children with characteristic B as listed in Column D in a third, all pupils with characteristic C as listed in Column E in a fourth etc.

I will also need to check the results in columns Q, R, S and T and copy and paste the pupil's names into a second set of tables, depending on both their characteristics and their result but am happy to ask about this later if need be!

Thanks for any help and advice in advance!

I would create an index column in, say starting in Z2, with something like "=COUNTIF(C$1:C2,"M")"

In Sheet2, A1 would be "Males" and A2 would be "=INDEX(Sheet1!A:A, MATCH(ROW()-1,Sheet1!Z:Z,0))"

For each other table for each characteristic, create another index column and index/match in Sheet2.

For QT, you could change Sheet1!A:A in index to Sheet1!Q:Q for each column respectfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM