I have a chart in Excel that references a lot of data from Sheet1. About a hundred data series.
It was very time consuming putting that chart together, and there are still 28 of them to go. The data for each one of them is in the same place, but in different sheets.
What would be an intelligent way to change all those references from Sheet1 to Sheet2, while not changing anything else?
I wrote a tutorial, Change Series Formula – Improved Routines, about the Excel chart series formula, including some VBA routines to modify the formula. You can use the posted VBA routines yourself, and they're included in my commercial Excel add-in software.
In its simplest form, the routine to change the series formulas in a chart goes like this:
Sub ChangeChartSeriesFormulas(cht As Chart, sOldString As String, sNewString As String)
Dim srs As Series, sOldFmla As String, sNewFmla As String
For Each srs In cht.SeriesCollection
sOldFmla = srs.Formula
sNewFmla = WorksheetFunction.Substitute(sOldFmla, sOldString, sNewString)
srs.Formula = sNewFmla
Next srs
End Sub
Call this from your code that determines which chart(s) to change and asks the user for find and replace strings.
To do the active chart:
ChangeChartSeriesFormulas ActiveChart, "Sheet1", "Sheet2"
To do all the charts on the active sheet:
Dim chob As ChartObject
For Each chob In ActiveSheet.ChartObjects
ChangeChartSeriesFormulas chob.Chart, "Sheet1", "Sheet2"
Next
Related
I'm trying to create two charts from a local cycling club's account spreadsheet. These will provide "at-a-glance" overviews of the state of the current finances.
The spreadsheet has a columns with incoming monies (receipts) and the date received, with similar columns for outgoing money (payments).
The first chart will sum up the incoming outgoing columns and display these in a simple column chart. A quick glance should show that the incoming column is taller than the outgoing (hopefully!). This is where I hit my first problem - I don't seem to be able to use SUM in the chart:
I have ended up having to reference a cell containing the sum of the column, but this sum takes into account a cell (C3) which contains balance brought forward from a previous year which I want to ignore for this chart:
The other chart I want is a line chart showing amount of money on the y-axis and time on the x-axis. The receipts line should go up over the year (again, hopefully) and the payments should go down. I'm not even close to getting this correct:
It should be something like this, so as the year passes (x-axis) the amount (y-axis) of receipts and payments increases:
How can I create these charts?
Spreadsheet is here - https://docs.google.com/spreadsheets/d/1-8DzB6c3rZ8evfNJ8iRcO_2BletbH81FV4hIis0-Fj4/edit?usp=sharing
I tried to replicate your graph and found some issues:
On the first graph, you cannot use formula in Data Range. The input should only be a A1 notation. Creating another entry on B16:C17 and use it as graph data is correct.
If you want to ignore C3, just change the formula in your C16 with =SUM(C4:C8)
Based on the sketch you've provided for the second graph, The data will only go up by getting running total or cumulative sum of each data per category (Receipts, Payments). Unfortunately, Google Sheet does not have built it function that can automatically do that. You have to create another column for cumulative sum.
Example:
For Receipts, insert this in D4:
=ArrayFormula(If(len(C4:C8),(SUMIF(ROW(C4:C8),"<="&ROW(C4:C8),C4:C8)),))
It will create another column with cumulative sum of C4:C8.
For Payments, insert this in H3:
=ArrayFormula(If(len(G3:G7),(SUMIF(ROW(G3:G7),"<="&ROW(G3:G7),G3:G7)),))
The dates from Receipts and Payments are different, if you only use the dates of Receipt, the data for Payments will be inaccurate. You need to create another table that will combine the dates and data of those two categories.
Try this:
J2: ={A4:A8;E3:E8}
K2: =ARRAYFORMULA(IFERROR(VLOOKUP(J2:J11, A4:D8, 4, false)))
L2: =ARRAYFORMULA(IFERROR(VLOOKUP(J2:J11, E3:H7, 4, false)))
Make sure to add Labels on K1 and L1.
It should look like this:
Once you have the data, just highlight J1:L11 and Go to Insert -> Chart -> Convert it to Smooth line chart -> Check Aggregate
The graph should look like this:
References:
VLOOKUP
ARRAYFORMULA
I am creating a home budget for myself in Google Sheets, working in Chrome on Windows 10. In the end, the budget will be composed of separate sheets for each month, containing tables for each Friday (payday) within that month. All such tables will follow a certain format and will pull arrays of budget data from an auxiliary sheet.
However, trial-and-error (mostly error) is abundant, and one quails at the thought of having to paste corrections across 52 tables. Is there any way to have each table emulate a formula set down in a template? For example, ideally, my template would contain something like:
=INDEX(IF(condition(relativeCell),namedRange1,namedRange2)
and the final product would pull that formula (with relative reference) to each table. If I discover a mistake or need to make a change, I can simply change the template, and all of the live tables would update their formulas.
Can this be done in Google Sheets?
Failing that, I already have a function that returns a cell's formula as string text. Can this be used to get the desired effect?
there is a formula called INDIRECT which does exactly that:
https://support.google.com/docs/answer/3093377?hl=en
I would like to create a new sheet from Google Form data which only imports cell data that matches specific criteria. Respondents have five response options for a number of questions (all questions have the same five options). I want the new sheet to only show the data in the cells that fit my criteria and the cells that don't, should be blank. I would like all rows and column formatting to remain the same.
I've got the import range part down, but I don't know should I use query, filter, if, or some other function?
Within the same spreadsheet, QUERY works well. You could also use QUERY(IMPORTRANGE( or just IMPORTRANGE if you want it to go to a different spreadsheet.
As Rubén said, if you want to maintain all the formatting, without manually doing it yourself on the destination sheet, you'll need to use script.
Query Reference
EDIT
See Sheet3 HERE. Make a copy to edit.
Any cell with a blue background has a formula. The main one is below.
=ARRAYFORMULA(IF('Form Responses 1'!D3:DD="","",SWITCH('Form Responses 1'!D3:DD,$D$1,"",$E$1,"",'Form Responses 1'!D3:DD)))
You will not be able to edit those columns. If you need to edit (like the "Comments/Adaptations" columns, you could modify the formula above and apply it column by column.
If that works, please click the green check mark to accept the answer!
Beside the number format, any formula keeps the format of the source range, so if your the format includes fonts styles, bold, italics, colors, etc., instead of a formula you should use a script.
I'm trying to convert some raw data in the form:
label1 | label2 | value into a grid with label1 as one axis and label2 as the other.
Right now, I'm using the formula =IFERROR(FILTER(raw!$C$1:$C, raw!$A$1:$A=$A2, raw!$B$1:$B=B$1), "") (i.e. pull the one value that matches both tho row header and column header and replace with blank if that value does not exist) copy+pasted across the entire spreadsheet to handle this, however, I'd like to do this with an arrayformula if possible to avoid having to re copy+paste it to every cell whenever I change the data.
Example sheet at https://docs.google.com/spreadsheets/d/1eCocAaSPaof8S5Ps4upcXab-9At5XhwvK4VBE5xsVB8/edit?usp=sharing
My actual reason for making the grid is taking summary data from bigquery and converting it to a chart, so if there is a better way to do that, I'd love to know that as well.
I think you want to pivot without aggregation.
It's a bit overkill but I have this code that adds two functions MELT (to unpivot tables) and CAST (to pivot without aggregation) to Google Sheets.
If you copy that code into your project (I haven't published it as an add-on yet, I ought to do it) you can then simply achieve your desired output with =CAST(A1:C11, B1, C1).
Turns out pivot tables are exactly what I needed...I just didn't know what they were called. Thanks!
I'm using a pivot table in a Google Spreadsheet that counts the occurrences of different types of event-types on given dates. The events are listed on one sheet, with a column for "Date" and column for "Type." Based on this a Pivot Table is produced.
The trouble is that for dates when an event-type is non-existent, COUNTA returns empty. I'd rather it return 0.
The reason is for charting and statistical purposes when you create a chart from this data, it interpolates between values, ignoring empty cells. I'd prefer that it display zero on the chart on the days when these event types don't exist...
Is this possible?
UPD: sorry, I've misunderstood what you need.
What if, on another worksheet, you write the following?
=arrayformula(IF('PivotSheetName'!A1:Z100="";0;'PivotSheetName'!A1:Z100))
(This formula makes a copy of your Pivot table on the new worksheet,
replacing empty cells with 0; moreover, the control elements of the
pivot table are copied to the new worksheet as well)