Excel automatically charting for concrete range of data - excel

Excel masters, I need help about charting in excel. I have a table with data ("WEEK number", "date of start", "some data") and chart! the problem is: I need when I add new week data the chart should automatically update but I need to see only 53 weeks. For example: if I add week 30 I need to see data on the chart from week 30 (2018) to week 30 (2019)
Thank you for your help in advance
Week # Start Date Data
20 05-13-2018 21,866
21 05-20-2018 20,317
22 05-27-2018 18,078
23 06-03-2018 19,254
24 06-10-2018 17,990
25 06-17-2018 19,589
26 06-24-2018 22,346
27 07-01-2018 18,985
28 07-08-2018 18,482
29 07-15-2018 17,493
30 07-22-2018 21,217
31 07-29-2018 16,205
32 08-05-2018 16,534
33 08-12-2018 16,694
34 08-19-2018 18,190
35 08-26-2018 20,559
36 09-02-2018 24,503
37 09-09-2018 26,074
38 09-16-2018 24,092
39 09-23-2018 33,828
40 09-30-2018 28,979
41 10-07-2018 28,493
42 10-14-2018 30,634
43 10-21-2018 29,473
44 10-28-2018 28,202
45 11-04-2018 30,088
46 11-11-2018 36,070
47 11-18-2018 36,689
48 11-25-2018 35,509
49 12-02-2018 27,794
50 12-09-2018 27,802
51 12-16-2018 16,521
52 12-23-2018 13,786
1 12-31-2018 18,271
2 01-07-2019 27,336
3 01-14-2019 29,837
4 01-21-2019 31,464
5 01-28-2019 31,395
6 02-04-2019 31,383
7 02-11-2019 28,152
8 02-18-2019 30,795
9 02-25-2019 25,183
10 03-04-2019 28,344
11 03-11-2019 38,064
12 03-18-2019 36,815
13 03-25-2019 36,741
14 04-01-2019 35,849
15 04-08-2019 35,199
16 04-15-2019 28,407
17 04-22-2019 16,427
18 04-29-2019 29,678
19 05-06-2019 28,270
20 05-13-2019 24,046
21 05-20-2019 21,191
22 05-27-2019 21,480
23 06-03-2019 23,919
24 06-10-2019 20,532
25 06-17-2019 20,575
26 06-24-2019 19,111
27 07-01-2019 19,279
28 07-08-2019 22,265
29 07-15-2019 5,979

You can use defined names to automatically update a chart range in Excel.
You can refer to any array/range by a name in excel. There are formulas to find the specific array/range and we call them Array Formulas. One of the most common array formula is OFFSET. If you are not familiar with this formula, please google some tutorials online before continue.
In your example, let's presume Week # is in Column A, Start Date is in Column B, and Data is in Column C, and the name of the worksheet is SheetName.
In order to dynamically look up a 53-Week range in Column A, B and C using OFFSET formula, you need to find the starting point (i.e. the cell in each column corresponds to the first week of the 53-week range) .
For instance, if your latest Week # is Week #29 in Cell A63, the starting point would be Week #29 in Cell A11. One way of finding the latest week # is to find the corresponding maximum/latest date in the Start Date column, and use MATCH formula to find the row number. Such logic is translated into the following formulas:
Start Point in Column A (the Week # column) ="A"&MATCH(MAX(B:B),B:B,0)-52
Start Point in Column B (the Start Date column) ="B"&MATCH(MAX(B:B),B:B,0)-52
Start Point in Column C (the Data column) ="C"&MATCH(MAX(B:B),B:B,0)-52
Then you can find the 53-Week range in each column by referencing the relevant starting point in the OFFSET formula. Please note you need to press CSE Ctrl+Shift+Enter upon finishing entering each array formula to make it work.
For Column A (the Week # column) =OFFSET(INDIRECT("SheetName!A"&MATCH(MAX(SheetName!$B:$B),SheetName!$B:$B,0)-52),,,53)
For Column B (the Start Date column) =OFFSET(INDIRECT("SheetName!B"&MATCH(MAX(SheetName!$B:$B),SheetName!$B:$B,0)-52),,,53)
For Column C (the Data column) =OFFSET(INDIRECT("SheetName!C"&MATCH(MAX(SheetName!$B:$B),SheetName!$B:$B,0)-52),,,53)
The next step is to create three names for the above ranges. Press Ctrl+F3 to open the Name Manager in excel, and manually create the names and copy and paste the above formulas in the 'Refers to:' field.
Then you can create a chart from the existing data, and replace the hard-coded series values with the range names to make it dynamic as shown below:
Click anywhere within the chart, then you will see the Chart Design tab shown on top of the the ribbon of your excel. Go to Select Data and Edit the Data and Date value as shown below:
I have created a sample bar chart below showing the data for the most recent 53 weeks. Please note I have added 5 weeks' of new data to test the result, and I have put the Week # as the data label for the bar chart instead of the actual dollar value.
Lastly, you can refer to the following article for more clarifications.
How to use defined names to automatically update a chart range in Excel

Related

Compare cell in excel

i have some data like below in one column.
Value
-----
A#show
20
20
B#show
20
25
30
C#show
10
10
10
10
D#show
10
E#show
10
20
I want to compare the values between the cell where the last string is "show" and if there is only one then no comparison.
Value Comparison
----------------------
A#show Same
20
20
B#show different
20
25
30
C#show same
10
10
10
10
D#show only one
10
E#show different
10
20
I think it's can be possible using a VBA script
It's a bit unclear what you're trying to compare between values. However, there is a way to do this without VBA.
1) In the Second Column, create a "Header" column which names which header each value belongs to. The first entry would just be A#show, but then the following would be:
=IFERROR(IF(A2*1>0,B1),B2)
2) In the third column, you can utilize countif to see if the header has more than 2 entries (indicating it has a comparison). Here is where you can apply whatever comparative metric you'd like. If it's something unformulaic, just use a pivot table with the 3 columns.

Look up Cell data based on Month header in table

i'm trying to create a small spreadsheet for data verification.
Below i have created two tables Table 1 and Table 2.
What i am trying to find is a simple =Index Match or similar to check for Current month then copy that value to respective Group row under verification.
Problem is that the months are a header row and i have no idea how to check a header row for correct month then output the values in the cells below it to each corresponding group in the output list.
So to put it in programming terms this is what im looking for
If A2=Table2[Header] then c8=C4 else table[header] + step right
A2 contains todays Date (=today()) and Header has the shorten Month names as Jan Feb Mar and so on.
Something similar as above, i don't know if i'm making it harder for me then it really should be. I'm working with Excel 2013.
Output list
Group Input Verification Differance
G1 120 123 =Sum([#[Input]]-[#[Verification])
G2 76 110 =Sum([#[Input]]-[#[Verification])
G3 110 90 =Sum([#[Input]]-[#[Verification])
G4 34 53 =Sum([#[Input]]-[#[Verification])
Data list
Group Year Jan Feb Mar Apr
G1 2017 123 95 80
G2 2017 110 85 75
G3 2017 90 80 70
G4 2017 53 53 46
Regards
Johan
You would use a second match to find the correct column:
=INDEX(DataList,MATCH([#Group],DataList[Group],0),MATCH(TEXT($A$1,"mmm"),DataList[#Headers],0))

Dynamic Chart in Excel

Country January February March April May June July
USA 34 34 45 34 23
China 45 56 34 23 12
Japan 34 54 23 23 24
How can I show the last 3 months in the chart every time I update the data. Considering that column "Country" is fixed. Any workaround or easy formula to use in my "data selection" when creating a chart.
This should work perfectly.
1. Re-arramge the data
Country USA China Japan
January 34 45 34
February 34 56 54
March 45 34 23
April 34 23 23
May 23 12 24
Like so, it will be easier to work with. Here we assume the data starts at cell A1.
2. Create names in Name Manager (ctr+F3 to open)
name: refers to:
months =OFFSET(Sheet1!$A$1,COUNTA(Sheet1!$A:$A)-1,0,-MIN(length,COUNTA(Sheet1!$A:$A)-1),1)
length 3
usa =OFFSET(months,0,1)
china =OFFSET(months,0,2)
japan =OFFSET(months,0,3)
In length, you note the desired time-period you wish to show (in your case 3 months); this can also be done with a cell reference and a COUNTA if you wish to make it dynamic and account for all the new data.
3. Create the chart
Click on blank cell and open the desired chart (I have done it with a
2-D Clustered Column). //Note that the chart should be blank.
Right-click on Select Data and click Add for Legend Entries
(Series). Here for Series Name, select whatever is desired (in your case USA China Japan). For Series Value add =Sheet1!usa
Do this two more times for =Sheet1!china & =Sheet1!japan
Finally for the Axis Label add =Sheet1!months
Click though OK and you should be all set!
Make sure you check out how the offset function works here: https://support.office.com/en-za/article/OFFSET-function-c8de19ae-dd79-4b9b-a14e-b4d906d11b66

Create a formula that returns a minimum date from a range based on cell values in another column

I am looking for a formula that will return the earliest date from a column, based on the contents of values in other cells. (Actually I want a Min and Max date, but am assuming the Max will be identical to any Min solution )I know I can return the date I want just by using MIN and specifying the range of cells I want, but I ideally want the formula to be dynamic. I have looked around and believe I possibly need to use a combination of index and match, but cant find any examples that use Min and Max. I have considered using dynamic named ranges to define my task groups, but that would mean having to define a static number of task groups, and there could be many task groups.
The sheet below shos some sample date on the left of the workbook, with the summary data on the right. The "hidden worker column" was an idea I had that I though might make the solution easier. So I want the summary data on the right to use either column A, or column B if its easier, to display the min and max dates based on the section number in column F - Is this possible without VBA?
#mthierer's link is good. If you wanted to remove the need to add a "helper column", you could try (data in A1:C10; summary table in E1:G2):
{=MIN(IF(ROUNDDOWN($A$1:$A$10, 0)=$E1, $B$1:$B$10))} (or {=MAX(...)} with $C$1:$C$10)
Note that you have to enter the formula as an array formula with CtrlShiftEnter.
Data (A1:C10):
1 23 57
1.1 42 91
1.2 35 100
1.3 39 80
1.4 28 51
1.5 30 96
2 33 52
2.1 11 73
2.2 48 80
2.3 16 59
Summary Results (E1:G2):
1 23 100
2 11 80

Extracting the upper quartile data from an array and placing it in new column

Hi and thanks for any help with this in advance
Below is a hypothetical data set; abundance = count data; mud% = the mud content in which the animals were found; mud bin = bins i've made up depending on the mud%; and UQ = upper quartile of the abundance data from its corresponding mud bin (i.e. the upper quartile for the abundance data in mud bin 1 is 17.25 etc).
Problem:
In excel, for abundance data in each of the four mud bins, I'm wanting to extract any values in the abundance column that are >= the upper quartile value for that particular mud bin and place these in a new column on the same sheet (with no gaps between rows from values that didn't meet the criteria) along with their corresponding mud% value in the neighboring cell. I've added the new columns to the below sheet to give you an idea of what I'm after.
abundance | mud% | mud bin | UQ | | New column | Mud% |
18 10.9 1 18 10.9(mud bid 1)
15 6.5 1 44 38.9(mud bin 1)
6 13.4 1 45 38 (mud bin 2)
13 42.1 1 37 37.8(mud bin 2)
15 36.4 1 etc
44 38.9 1 17.25 etc
22 46 2
30 36.4 2
45 38 2
29 35.3 2
37 37.8 2
29 41.8 2 35.25
11 44.4 3
17 47.8 3
21 40.7 3
15 13.9 3
35 13.9 3
14 13.9 3
15 13.9 3 19
19 12 4
14 12 4
10 12 4
12 12 4
14 12 4
13 12 4
45 9.525 4
66 9.525 4
78 9.525 4 45
The reality is I have a rather large dataset containing abundance data for a number of species, all on the same excel sheet and would greatly appreciate any insight into how I might achieve this in the most efficient manor.
For starters, to make this explanation simpler, I will assume that the last row of data is in row 100.
Populate Upper Quartile values for all line items
First you'll need to use the Quartile formula; however, since you want to find the upper quartile within a bin, you'll have to use an array formula. Put this formula in your UQ column (place in cell D2 and drag down). When entering the formula Be sure to press Ctrl+Shift before pressing Enter
=QUARTILE(IF($C$2:$C$100=C2,$A$2:$A$100,""),3)
The first part of this formula, $C$2:$C$100=C2 is your condition. Everywhere this condition is met, you will get the corresponding value in $A$2:$A$100; otherwise, you'll get a blank value. This will give you an array of abundance values that matches the indicated mudbin, C2. now that you have your subset of data, the quartile function will give you the value in the 3rd quartile (17.25 for mudbin 1, which will be placed next to every row that has a mudbin of 1).
Now that we have all the quartiles, we can get all the abundance values that are greater than the UQ for that mudbin. This is done in two parts
Get abundance values greater than mudbin UQ
First, you need to select one column of cells that has the same number of rows as your data (for example, select cells F2:F100)
Enter the following formula into the formula bar (while F2:F100 are highlighted) and press Ctrl+Shift, then enter
=IF($A$2:$A$100>$D$2:$D$100,$A$2:$A$100,"")
Similar to the IF statement used before, this formula finds all the abundance values that are greater than their corresponding UQ value. Now column F will have an abundance number where it is greater than it's UQ value, and a blank where it is not. Now onto the final step.
Populate abundance values that are greater than the UQ value, without the blanks
Select G2:G100 (your "New Column" in your sample data)
Enter the following formula into the formula bar (while G2:G100 are highlighted) and press Ctrl+Shift, then enter
=INDEX(F2:F100,SMALL(IF(F2:F100<>"",ROW(F2:F100)-1),ROW()-ROW($F$1)))
Looking at the IF statement again, this will find every value in F2:F100 that is not blank, but instead of grabbing the values, we'll keep track of the row number of that non blank value (done by ROW(F2:F100)-1
). Now that we have the row numbers of all the non blank values, we can grab the non-blank values in order and populate them in G2:G100. ROW()-ROW($F$1) is a counter, and SMALL will use the counter to determine the nth smallest number to return. Once we have our row number of the non blank value, INDEX returns that value
Finally, to populate the Mud%, you'll need to use the row number of the non blank values to get the mud% and the mud bin (You have the formula already to get the row number of the non blank value).
It's not a simple answer, but at least you won't have to use VBA.

Resources