Questions tagged [google-sheets-formula]

Do NOT share spreadsheets/images as the only source of data. Use markdown TEXT tables instead. Use this tag for Google Sheets questions that involve the use of spreadsheet formulas. Use together with tags such as [google-sheets] for broader visibility, [array-formulas], [google-query-language] or [custom-functions]+[google-apps-script] when the formula includes a custom function written in [google-apps-script]. Avoid use with [excel] and [excel-formulas].

Resources:

Sharing your data:

Sharing your data helps other community members in visualizing your data. This can be done through

  • Tables(Mandatory):
    Markdown help can be found here. You can easily create a table using the formula: =ARRAYFORMULA("|"&A1:G20), if you want to share A1:G20. However, the first row A1:G1 must be a header row AND the second row A2:G2 should only contain dashes -- in all the cells.
  • CSV:
    Use File > Export to csv

  • Published Google sheets(in addition to text table):
    In the sheets file, click File > Share > Publish to web.

  • Share to others(in addition to text table):
    In the sheets file, click File > Share to others > Anyone with link. Note, however that sharing Google sheets this way makes your email address visible to public.

  • Screenshots(in addition to text table):
    This shows your data structure but makes it hard for anyone to copy data from the question for testing

If questions depends on external links/images, they will be closed. Text tables is mandatory.

Related tags

11122 questions
539
votes
7 answers

Conditional formatting based on another cell's value

I'm using Google Sheets for a daily dashboard. What I need is to change the background color of cell B5 based on the value of another cell - C5. If C5 is greater than 80% then the background color is green but if it's below, it will be amber/red. …
224
votes
21 answers

Get the last non-empty cell in a column in Google Sheets

I use the following function =DAYS360(A2, A35) to calculate the difference between two dates in my column. However, the column is ever expanding and I currently have to manually change 'A35' as I update my spreadsheet. Is there a way (in Google…
Michael S
  • 4,352
  • 5
  • 23
  • 29
203
votes
8 answers

Count cells that contain any text

I want to count the cells that contain anything within a range. Any cell that contain text, or numbers or something else should do a plus one in my result-cell. I found this function, countif(range; criteria) but this doesn't work for me, because I…
steak
  • 2,117
  • 2
  • 13
  • 12
174
votes
17 answers

Apply formula to the entire column

I'm changing all the zip codes from Column A into Column B with the formula: =TEXT(A1,"00000") Like this: I want every cell in Column B to be transformed using the formula above. But I have over 40,000 rows, so it is not feasible to drag the…
skydv
  • 1,789
  • 3
  • 12
  • 7
138
votes
13 answers

Count rows with not empty value

In a Google Spreadsheet: How can I count the rows of a given area that have a value? All hints about this I found up to now lead to formulas that do count the rows which have a not empty content (including formula), but a cell with =IF(1=2;"";"") …
Robbit
  • 1,537
  • 2
  • 9
  • 10
119
votes
7 answers

How to union ranges in google spreadsheets

I want to union ranges from any Google spreadsheets. The example Sheet1!A:A {12, 131, 45} Sheet2!A:A {12, 131, 46} The unknown function =formula_for_union_range(Sheet1!A:A; Sheet2!:A:A) should return {12, 131, 45, 12, 131, 46} The question How…
113
votes
24 answers

Selecting the last value of a column

I have a spreadsheet with some values in column G. Some cells are empty in between, and I need to get the last value from that column into another cell. Something like: =LAST(G2:G9999) except that LAST isn't a function.
109
votes
6 answers

ISO-8601 String to Date in Google Sheets cell

I have a bunch of ISO-8601 formatted strings in a column of my sheet. How can I get google sheets to treat them as Dates so I can do math on them (difference in minutes between two cells, for example)? I tried just…
Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
70
votes
4 answers

ArrayFormula and "AND" Formula in Google Sheets

In Google Sheets, when using ArrayFormula with AND formula, I don't get the results as it should be. A B 6 7 In C1 I put formula as: =and(A1>5,B1>6) then I get True. If in D1 I put formula as: =ArrayFormula(and(A1:A>5,B1:B>6)) I get the…
Hossein
  • 720
  • 1
  • 5
  • 7
67
votes
5 answers

How do I add formulas to Google Sheets using Google Apps Script?

How do I add a formula like: =SUM(A1:A17) to a range of fields using Google Apps Script for Google Sheets?
Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102
50
votes
4 answers

Split string and get last element

Let's say I have a column which has values like: foo/bar chunky/bacon/flavor /baz/quz/qux/bax I.e. a variable number of strings separated by /. In another column I want to get the last element from each of these strings, after they have been split…
Max Williams
  • 32,435
  • 31
  • 130
  • 197
48
votes
6 answers

Counting number of occurrences in column?

What would be a good approach to calculate the number of occurrences in a spreadsheet column? Can this be done with a single array formula? Example (column A is input, columns B and C are to be auto-generated): | A | B | C …
feklee
  • 7,555
  • 9
  • 54
  • 72
44
votes
5 answers

Sum of row n through last row

I want to create a TOTAL row at the top of my spreadsheet. In this row, each cell should be the SUM of the values in the column below the TOTAL row. So for example, if the total row is Row 1, cell A1 should be the SUM of A2 through the last row in…
Nick Petrie
  • 5,364
  • 11
  • 41
  • 50
43
votes
4 answers

How do I combine COUNTIF with OR

In Google Spreadsheets, I need to use the COUNTIF function on a range with multiple criteria. So in the table below, I would need to have something like =COUNTIF(B:B,"Mammal"or"Bird") and return a value of 4. A |B ------------------- Animal…
42
votes
13 answers

Is there a way to evaluate a formula that is stored in a cell?

In a Google Docs spreadsheet, I'm looking for something like =EVAL(A1) where A1 is set to "=1+2". I found out that in MS Excel there is an EVALUATE() function (which seems a bit tricky to use properly). But I could not find anything similar in…
1
2 3
99 100