how to make a new table from an existing table and add new column in spreadsheet

不打扰是莪最后的温柔 提交于 2021-02-11 08:43:00

问题


I want to Ask about spreadsheet or google-sheets formula. I have a data that looks like this:

   A       B           C          D
   ------------------------------------------------
1 | UserId  fruitType   media     PriceStatus
2 | 3       Apple       Bag       Paid
3 | 7       Banana      Bag       Paid
4 | 7       Apple       Bag       Paid
5 | 43      Banana      Bag       Paid
6 | 43      Apple       Bag       FREE
7 | 43      Apple       Cart      Credit

Note:

  1. My data only consist of 2 type of fruit : Apple and banana
  2. 2 type of media : Bag and Cart
  3. 3 Type of PriceStatus : Paid, Credit, & Free

As you can see the column is the same as the one in spreadsheet that I give value A-D and the row as 1-7, My plan is to make the sheets look like this:

UserId  Apple   Banana
3          1       0
7          1       1 
43         2       1

is it possible to make a new table like this in spreadsheet? I tried using VLOOKUP but still failed to implement it, can someone help me with this?


回答1:


try:

=QUERY(A1:D, "select A,count(A) where A is not null group by A pivot B", 1)



来源:https://stackoverflow.com/questions/59064462/how-to-make-a-new-table-from-an-existing-table-and-add-new-column-in-spreadsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!