How do I modify series values for charts in Excel - excel

So if I have the numbers 1 through 5 in cells A1 through A5, when I select series values for a chart in Excel, how do I plot A1:A5 as -1 through -5?
How can I modify:
='All Data'!$A$1:$A$5
without creating cells on my spreadsheet?

Put a hyphen in A1 before 1, copy A1, select A2:A5 Paste Special, Values with Operation Multiply.

"How can I modify [the input data] without creating cells on my spreadsheet?"
Excel plots worksheet data. It sounds like A1:A5 contains your Y values and you want X values of -1 to -5. The most efficient way to do this is to put these values into a worksheet range, and using the Edit Data dialog, set this range as your X values.
You can use an array of values, which seems great but is harder to maintain, and you are limited to how large an array you can use.
If you plot your Y values, you get a series formula like this (select the chart series and look at the formula bar):
=SERIES(,,Sheet1!$A$1:$A$5,1)
There are no entries for series name, so Excel just calls it Series1, nor for X values, so Excel uses 1,2,3,4,5.
Edit the series formula to this:
=SERIES(,{-1,-2,-3,-4,-5},Sheet1!$A$1:$A$5,1)
Note: If you make an XY Scatter chart, this array will be used as numerical X values, and by default -5 will be furthest left.
If you make a line chart, the line will be unchanged, but the array entries will be used as text (non-numeric) labels in the left-to-right order in which they appear in the array.

Related

Excel ultra-dynamic ranges with OFFSET(...COLUMN()) to convert to non-volatile

I think I made a breakthrough with "ultra-dynamic" ranges. That's how I call them because not only they are dynamic; but also they refer to different ranges based on the cell address in which they are written in! Now I need to advance this breakthrough even further. Those of you using dynamic ranges in Excel, especially the dynamic-range-gurus, will be thrilled to read below and can possibly help in this advancement:
Disclaimer: If you are not familiar with dynamic ranges do not attempt to read below!
Background:
Our sheet has cells with calculations on top and a pivot table below.
Each cell above refers to the pivot table cells below in the same column.
The first column of the pivot table (titled "Row Labels" by default) is sorted from top to bottom in descending order. Each of the next columns has the result of a different test.
At one point somewhere in the middle rows of the pivot table there is a "marker line" that separates the top part of the pivot from the bottom one.
Let's call the top part "Uppers" and the bottom part "Downers".
Let's call both parts together "Population". Population is a non-contiguous range because the "marker line" that separates the Uppers from the Downers intervenes.
For each cell above the pivot there are calculations for the pivot column exactly below that need to refer to the Uppers or Downers or Population of the column itself.
Previously, my formulas in all of the cells above were a repetition of something like this below:
= MAX( OFFSET($A$79,$B$5+1,COLUMN()-1,$B$6,1) )
This example gives the maximum of the area of the Downers in the same column below.
Where:
A79 is the top left corner of the pivot table,
B5 has the row number of the marker line (relative to A79) to signify that our column's Downers area starts from the first row below that marker row (hence the "+1"). The formula of that cell has an XMATCH formula to produce the resulting row number. For example if the Uppers are positive numbers and the Downers are negative numbers, all sorted in descending order, the XMATCH is searching for the 0 row that separates the two parts of the population.
COLUMN()-1 returns the current column's number for offsetting to the right and the -1 is necessary because the first column is 0 rather than 1 offset to the right, and
B6 has the number of rows ("height") to the last row number of the pivot (relative to B5) where our Downers end. The cell contains the usual COUNTA function that counts the number of rows in the pivot table and from this number it subtracts the number of the marker row in B5 to get the "height" of the Downers range.
The OFFSET... part of the formula when copied to any cell with calculations above the pivot will always give the Downer's area in the same column.
And here we come to the "ultra"-dynamic part: I tested (and it works!) naming a range as:
ColDowners: =OFFSET($A$79,$B$5+1,COLUMN()-1,$B$6,1)
And I substituted all the cells with calculations that refer to the Downers with something like:
= MAX( ColDowners )
Miraculously, all cells with this named ultra-dynamic range, are calculated with the correct values for the Downers exactly below them in the same column! Sometimes when the Workbook is initially loaded, the cells appear with 0 values, but immediately when you hit F9 to Calculate they get the correct value (which of course is not a problem).
So this range is "dynamic" in two ways: (1) because start and end rows are dynamic (as usual) and (2) because it results to a different range depending on where it's written!!
And now for the advancement. Any dynamic-range-guru's input would be extremely valuable:
OFFSET is a volatile function with the known performance issues. Can we replace it with two non-volatile INDEX functions separated by a colon (":")? I know how to name a range that starts from a specific cell and ends in a different one every time (eg. =A$155:INDEX(...COLUMN()...)). But can BOTH the start and end of the range be INDEXified [sic]? i.e. can it be something like =INDEX(...COLUMN()...):INDEX(...COLUMN()...). And, consequently, if we name a range with this formula, will it work?
Answers will have to exclude volatile functions like INDIRECT and will have to be as simple as possible. The resulting range of the formula of the ultra-dynamic range will have to be different depending on which COLUMN() it's written in in the sheet (like the OFFSET one above) and will have to be "able" to start from a specific number of rows below A79 (the number written in B5 in the example above) and end in the one written in B6.
The correct formula that defines an ultra-dynamic-range for replacing the 'OFFSET' formula:
=OFFSET($A$79,$B$5+1,COLUMN()-1,$B$6,1)
Is:
=INDEX($A:$XX,ROW($A$79)+$B$5+1,COLUMN()):INDEX($A:$XX,ROW($A$79)+$B$7,COLUMN())
Where in B7 is the number of the last row of the pivot. (=Something like B5+B6 plus/minus 1 or 2 - test it for your case)
If you Define a Name of a Dynamic Range with this ultra-dynamic formula, it will adapt to give you different ranges depending on the location of the cell where you copied it to!! It will always give you the same parallel range in your column and will produce different results in different columns! I tested it and it works perfectly, plus it made my calculations lightning faster since INDEX is non-volatile (as opposed to OFFSET).
One more tip for the example above: I also tried nested range names and they work! For example I Defined the Range for ColPopulation as:
=(ColUppers,ColDowners)
Note that this is an ultra-dynamic-nested-range-name! Of course, it can work only for simple functions (such as =MAX(ColPopulation)) and will not work in functions such as SUMPRODUCT that need contiguous ranges. Still, it is a very useful thing to know that you can Define Ranges by adding other range names with commas!
Great help from all involved! Thanks a lot!

Determine if values in a column are between 2 numbers in an array

Excel formula that looks up if X is in between 2 values in a matrix and says yes or no (1 or 0). This formula is intended to be copied as the Y-value to the X. X column will be up to 50,000 rows and the matrix will be up to 100rows
This code works:
=IF(OR(AND(A2>=$D$2,A2<=$E$2),AND(A2>=$D$3,A2<=$E$3)),1,0)
but will get very cumbersome if the matrix gets larger, ie up to 50 rows. I also tried:
{=IF(AND(A2>=$D$2:$D$3,A2<=$E$2:$E$3),1,0)}
but returns #VALUE!
You could also make use of SUMPRODUCT() like so in B2 and drag down:
=IF(SUMPRODUCT((A2>=$D$2:$D$3)*(A2<=$E$2:$E$3))>0,1,0)
And here is a way to make it easy on yourself, create a table out of your ranges, and if you add or remove from there the formula will adjust. Like so:
=IF(SUMPRODUCT((A2>=Tabel1[X1])*(A2<=Tabel1[X2]))>0,1,0)
If you can, add an extra column to the "matrix" to store the result (1,0) for each range.
Use vlookup with approximate results

Excel Graph: X,Y points in alternating columns, different series per row

We receive a large CSV data file where each row contains a few columns of metadata and then an arbitrary length sequence of X,Y point values in alternating columns. Different rows may contain different numbers of points. The actual data may contain hundreds of rows, each with many X,Y values (possibly a couple of thousand points).
The format of this data file is not within our control.
As a simple sample for illustration:
Series 1,ID142,2,45,7,21,1,65.5,14,22
Series 2,ID082,11,23,6,15,3,29,13,84,9,78,42,45,15,17
The above example would represent two series: Series 1 with points (2,45), (7,21), (1,65.5), (14,22), and Series 2 with points (11,23), (6,15), (3,29), (13,84), (9,78), (42,45), (15,17).
The most useful way to analyze this data would be multiple series in a scatter plot in Excel. An engineer might be interested in seeing a scatter-plot with row 1 data as series 1 and row 58 data as series 2. That might lead to wanting to see a plot of row 8 and row 97. So, it would not be realistic to have a complicated process to reformat the data depending on the rows of interest.
Is there a way to easily build Excel scatter-plots with multiple series from data where each series is represented by a single row with the multiple X and Y values all in that row in alternating columns (as the sample above)?
You could use the offset function. You can open a new sheet and write this in the first cell A1, press control+ shift+ enter
and drag the formula across the columns
=OFFSET(Sheet1!A1,M,0,1,100)
similarly do this in A2 and drag it across
=OFFSET(Sheet1!A1,N,0,1,100)
This would return the Mth row from top in sheet 1 completely into first row, and Nth row into the second row. You can give reference to M and N values in different cells to make it dynamic.

How do i use Specified Data as an axis in excel

I have a question about doing a graph in excel, i im trying to make a representation of an accelerometer. in this i have 4 values X,Y,Z and time between measurements.
X=1,039 Y=8,743 Z=4,747 TIMEms=4
I have 600+ value sets like this and i want to make 3 graphs for X,Y,Z with TIMEms as the distance between each datapoint on the horizantal axiz. How can i do this?
I tried using the values of TIMEms but this just gives me a horizontal axis consisting of 5's with the default distance of 1 between them.
If you currently have a sheet with columns X, Y, Z and TIMEms, you'll need to add a new column to the end to roll-up all the time differences.
Let's assume you have this sheet, and TIMEms is column D. In column E, label it "Time" in cell E1, and in E2 set this equal to zero. E3, set to the formula:
= E2 + D2
Copy/paste this formula down the column (assumes the time quoted in column D is the time since the last observation, rather than time until next observation). You should now see time increase down this column as a "milliseconds since recording began".
Next you'll need to insert a scatter chart (whichever flavour you prefer), setting the X-values to be the values in column E, and the Y values to be whichever of the X/Y/Z values you want to plot. On the "Insert" ribbon, in the "Charts" area, look for the graph looking like a bunch of unconnected points - hover over it and it should say "Insert scatter (X,Y) or Bubble chart" - select one of the scatter charts.
When you have the chart object, you need to wire up the data correctly with the "Select Data" UI you get access from when right-clicking on the chart object. Click "Add" and you get a dialog prompting you for the series name, the X-values and the Y-values - enter appropriate ranges in those boxes, for example X-values would be "=E2:E600", and Y-values "=B2:B600", to plot the actual Y values.
You can also add more series to the chart to get each of X, Y and Z on the same chart, if you so desire.

excel fix value for chart

i have some data in excel 2007 and draw a line chart with them, so i have two series: one for data and a series for average to compare data with average. now i want to add a fix value for series 2(average) to draw average line in chart.
series 2(average) value ={Sheet3!$I$18,Sheet3!$I$18,Sheet3!$I$18}
the average value is in i18 cell
but it has error about "the formula you typed contains an Error"
any body to help me to draw average line?
my data are in d24:d26 cells
and average is in i18
if i use const number it's working like below:
series 2(average) value ={5003,5003,5003}
but i want read the series value from cells, which on change the average number(i18 cell) the charge series(average line) change too.
In cell G24 enter
=$I$18
Copy to cells G25 and G26.
Now select cells G24 to G26 and copy. Select the chart and use Paste Special. Accept the defaults. The chart now has the average line.
By definition, a line needs at least two data points, beginning and end. You could leave cell G25 empty, but then you must tell Excel to connect the line between empty cells. That setting is in the Select Data dialog behind the button "Hidden and empty cells". With that approach you can avoid duplicating the average value for each data point.
Here is a screenshot with such a setup.
Edit: It can be done with just one cell but it's a lot more preparation.
Add the single cell to the chart as a new series.
Change that series to XY Scatter
Edit the series values, set X to 1, set Y to the cell value
add horizontal error bars to the average series, with settings being Plus, No Cap, Fixed value (count the number of data points in the line and enter that as the fixed value)
format the error bar line as desired and format the data marker to be invisible. Here is how this can look:

Resources