Is it possible to add rows with a built-in function (such as `MIN()` or `INDIRECT()`) in Google Sheets?

I would like to fill rows in the main sheet such as 

```
+---+----+--------+
| A | 18 | Atext1 |
| A |  5 | Atext2 |
| C | 23 | Ctext1 |
| A | 12 | Atext3 |
| B |  0 | Btest1 |
+---+----+--------+

```

Then, I would like the spreadsheet to use the "main sheet" so that I see in another sheet:

```
+------------+----+--------+
| Category A |    |        |
| A          | 18 | Atext1 |
| A          |  5 | Atext2 |
| A          | 12 | Atext3 |
| Category B |    |        |
| B          |  0 | Btest1 |
| Category C |    |        |
| C          | 23 | Ctext1 |
+------------+----+--------+

```

The only difficulty I have is to dynamically insert lines depending on how many As or Bs are in the main sheet.

Is there a function to do this easily (= without writing a script---I'd prefer to avoid going into this)?