dm199406
dm199406

Reputation: 23

Is there a formula to sort data containing certain text and date?

Google Sheets.

I need to pull the data from the Raw Data sheet into the date and cost columns (in red). I need the data to match the named platform (in blue) and show the date and corresponding cost in ascending order.

I've managed to complete one part of the formula, where it pulls the cost for the platform, but my issue is I then have to add the dates in manually. I tried:

=SUMIFS('Raw Data'!C:C,'Raw Data'!A:A,$B$5,'Raw Data'!B:B,B10)

Is there a way to have the date and cost in ascending order pulling from the raw data sheet with a formula?

Sample data in Raw Data:

       A             B           C 
1   Traffic source  Date    Cost (GBP)
2   LinkedIn    2019-01-04  16.29
3   LinkedIn    2019-01-05  16.35
4   LinkedIn    2019-01-06  16.41
5   LinkedIn    2019-01-08  7.88
6   LinkedIn    2019-01-09  7.72
7   LinkedIn    2019-01-03  15.62
8   LinkedIn    2019-01-02  16.31999
9   LinkedIn    2019-01-01  16
10  LinkedIn    2019-01-18  39.76001
11  LinkedIn    2019-01-19  40.39001
12  LinkedIn    2019-01-20  40.50001
13  LinkedIn    2019-01-21  40.85999
14  LinkedIn    2019-01-22  40.80777
15  LinkedIn    2019-01-23  5.37306
16  LinkedIn    2019-01-07  9.27999
17  LinkedIn    2019-01-17  8.05
18  Instagram   2019-01-01  10.01
19  Facebook    2019-01-01  10.15
20  Instagram   2019-01-02  10.06
21  Facebook    2019-01-02  10.44
22  Instagram   2019-01-04  9.84
23  Facebook    2019-01-04  9.8
24  Instagram   2019-01-09  9.91
25  Facebook    2019-01-09  10
26  Instagram   2019-01-11  9.91
27  Facebook    2019-01-11  9.85
28  Instagram   2019-01-14  9.86
29  Facebook    2019-01-14  10.08
30  Instagram   2019-01-15  9.99
31  Facebook    2019-01-15  9.82
32  Instagram   2019-01-21  10.01
33  Facebook    2019-01-21  9.86
34  Instagram   2019-01-22  9.98
35  Facebook    2019-01-22  10.25
36  Instagram   2019-01-23  3.1
37  Facebook    2019-01-23  3.49
38  Instagram   2019-01-07  10.15
39  Facebook    2019-01-07  10.1
40  Instagram   2019-01-10  10.02
41  Facebook    2019-01-10  10.02
42  Instagram   2019-01-08  10.01
43  Facebook    2019-01-08  10.08
44  Instagram   2019-01-03  9.99
45  Facebook    2019-01-03  9.86
46  Instagram   2019-01-17  9.9
47  Facebook    2019-01-17  10.21
48  Instagram   2019-01-06  10.01
49  Facebook    2019-01-06  10.22
50  Instagram   2019-01-13  10.09
51  Facebook    2019-01-13  10.24
52  Instagram   2019-01-20  10.06
53  Facebook    2019-01-20  10.11
54  Instagram   2019-01-19  10.11
55  Facebook    2019-01-19  9.52
56  Instagram   2019-01-12  9.99
57  Facebook    2019-01-12  9.73
58  Instagram   2019-01-16  10.11
59  Facebook    2019-01-16  10.16
60  Instagram   2019-01-05  10.2
61  Facebook    2019-01-05  9.66
62  Instagram   2019-01-18  9.94
63  Facebook    2019-01-18  9.97
64  Google  2019-01-02  0
65  GDN 2019-01-02  0
66  Google  2019-01-05  19.11
67  GDN 2019-01-05  0
68  GDN 2019-01-06  0
69  Google  2019-01-06  21.14
70  Google  2019-01-13  20.22
71  GDN 2019-01-13  3
72  Google  2019-01-14  14.39
73  GDN 2019-01-14  1.66
74  Google  2019-01-10  13.51
75  GDN 2019-01-10  0
76  Google  2019-01-18  23.85
77  GDN 2019-01-18  8.33683
78  Google  2019-01-03  9.84
79  GDN 2019-01-03  0
80  Google  2019-01-21  29.14
81  GDN 2019-01-21  8.4
82  Google  2019-01-04  17.32
83  GDN 2019-01-04  0
84  Google  2019-01-15  41.75
85  GDN 2019-01-15  2.11
86  GDN 2019-01-07  2.23
87  Google  2019-01-07  22.2
88  Google  2019-01-11  17.55
89  GDN 2019-01-11  2.43
90  Google  2019-01-20  20.81
91  GDN 2019-01-20  3.32
92  Google  2019-01-17  19.12
93  GDN 2019-01-17  0
94  Google  2019-01-22  22.01
95  GDN 2019-01-22  3.553586
96  Google  2019-01-08  15.23
97  GDN 2019-01-08  2.91
98  Google  2019-01-19  29.97
99  GDN 2019-01-19  5.181001
100 Google  2019-01-12  20.24
101 GDN 2019-01-12  2.91
102 Google  2019-01-23  11.12
103 GDN 2019-01-23  0
104 Google  2019-01-01  11.69
105 GDN 2019-01-01  0
106 Google  2019-01-09  18.34
107 GDN 2019-01-09  1.41
108 Google  2019-01-16  18.54
109 GDN 2019-01-16  1.13

Extract from sheet for required output:

Extract from sheet for required output

Upvotes: 2

Views: 57

Answers (1)

pnuts
pnuts

Reputation: 59485

Probably something like:

=query('Raw Data'!A:C,"select B,C where A contains 'Facebook' order by B")

but maybe by C rather than by B.

Upvotes: 3

Related Questions