Excel Dynamic Chart - excel

I would like to create a dynamic chart. For example, I would like to plot the Apple and Banana series dynamically using the table below (Table).
A B C D E
1 X Y Z Min/Max Row
2 1 1 Apple Apple Min 2
3 2 2 Apple Apple Max 3
4 3 3 Banana Banana Min 4
5 4 4 Banana Banana Max 6
6 5 5 Banana
Thus far, I have created 2 formulas using the OFFSET function as shown below:
=OFFSET(Sheet1!$A$2,0,0,Sheet1!$E$3-Sheet1!$E$2+1)
=OFFSET(Sheet1!$B$2,0,0,Sheet1!$E$3-Sheet1!$E$2+1)
This will plot the Apple series, but next I would like to plot the Banana series and I'm not sure how to modify the OFFSET Reference to start at the correct row.
What I want are formulas like this but with proper OFFSET Reference syntax:
=OFFSET(Sheet1!$A$**Sheet1!$E$4**,0,0,Sheet1!$E$5-Sheet1!$E$4+1)
=OFFSET(Sheet1!$B$**Sheet1!$E$4**,0,0,Sheet1!$E$5-Sheet1!$E$4+1)
Also, if you know of a more elegant way to define the OFFSET Height, please share.
Thanks in advance for your help!
Cheers

Related

Recursive loop for 11 "min or max" variables

it's been a while since I coded much in VBA so getting myself tangled in the loops.
I have a table (B3:E14) which I want to loop through to return all permutations, placing them one by one in the final column ("Test"), where I'll run some other code, then transpose that test column into a row of results with variables as columns.
Variable
Min
Max
Test
Apples
5
6
i
Bananas
2.5
3.5
j
Oranges
-2
-1
k
Does that make sense?
So my final table might look something like...
Run
Apples
Bananas
Oranges
etc
1
5
2.5
-2
2
6
2.5
-2
3
5
3.5
-2
4
5
2.5
-1
etc
2048
6
3.5
-1
Darren
Yes, it is possible to do that.
You should check out this article, about different loops in VBA, you'll get your answers here.
https://trumpexcel.com/vba-loops/
Here you can find some examples about looping through a table.

Excel sort by similar cell data

So I have this list of data that i need to compare 2 spreadsheets with. Im going to simplify it with a list like below(Column A being a part number, and column B being a quantity):
Spreadsheet 1:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Spreadsheet 2:
Red 1
Green 1
Blue 2
Orange 6
Yellow 8
Silver 2
Brown 3
Now what i would like my output to be:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Silver 2
Brown 3
Notice that im sorting it so that list 2 aligns with list one, and if list 2 contains things that are not on list 1 it puts it at the bottom(preferably vice-versa compatible). Im not sure if this is even possible, but if it is it will GREATLY decrease my workload so any help is MUCH appreciated. Thanks for your time!

Count duplicate values in a sequence

How can I count duplicate data in a column using excel?
Example
A B
apple 1
apple 2
apple 3
ball 1
bat 1
dog 1
dog 2
gole 1
gole 2
gole 3
gole 4
I think there is no uniform formula for all cells in your case.
I would suggest something like this:
Put this on B column and then fill down the rest.
=COUNTIF($A$1:$A1,$A1)
After you fill the other rows, values of rows would look like this
B1=COUNTIF($A$1:$A1,$A1)
B2=COUNTIF($A$1:$A2,$A2)
B3=COUNTIF($A$1:$A3,$A3)

Multiple value lookup accross excel sheets

I have a master worksheet and a Extract worksheet.
I want to extract data from Extract sheet and present it as follows in the master sheet.
Data is as follows:
Extract Sheet
--------------------------------------
Fruit Nutrients Proportion
Apple Calcium 10
Apple Vitamin B 20
Mango Vitamin A 50
Lemon Vitamin C 30
Lemon Vitamin A 10
Master Sheet
--------------------------------------------------------
Fruit Calcium Vitamin A Vitamin B Vitamin C
Apple 10 0 20 0
Mango 0 50 0 0
Lemon 0 10 0 30
I have used Excel Array functions SMALL and INDEX but
I am unable to get the Proportion value in the master table.
I keep getting #NUM error
Please help me with the same and guide.
Thanks in advance.
I've put your sample data and results into a single worksheets as per the following image but you should be able to move the Extract to another worksheet and transcribe the formula for your own purposes.
    
The standard formula in F2 is =IFERROR(INDEX($C$2:$C$6,MIN(INDEX(ROW($1:$5)+(($A$2:$A$6<>$E2)+($B$2:$B$6<>F$1))*1E+99,,))),0). Fill both right and down as necessary. You mentioned using SMALL but you have no duplicated values across the two criteria columns so I think this is closer to what you require. Post back a comment if you do need a SMALL function with k picking the first, second, etc.
Try this:
=IFERROR(LOOKUP(2,1/(('Extract '!$A$2:$A$6=$A2)*('Extract '!$B$2:$B$6=B$1)),'Extract '!$C$2:$C$6),0)

rearranging data in excel

I'm not sure how to ask this question without illustrating it, so here goes:
I have results from a test which has tested peoples attitudes (scores 1-5) to different voices on a 16 different scales. The data set looks like this (where P1,P2,P3 are participants, A, B, C are voices)
Aformal Apleasant Acool Bformal etc
P1 2 3 1 4
P2 5 4 2 4
P3 1 2 4 3
However, I want to rearrange my data to look like this:
formal pleasant cool
P1A 3 3 5
P1B 2 1 6
P1C etc
P1D
This would mean a lot more rows (multiple rows per participant), and a lot fewer columns. Is it doable without having to manually reenter all the scores in a new excel file?
Sure, no problem. I just hacked this solution:
L M N O P Q
person# voice# formal pleasant cool
1 1 P1A 2 3 1
1 2 P1B 4 5 2
1 3 P1C 9 9 9
2 1 P2A 5 4 2
2 2 P2B 4 4 1
2 3 P2C 9 9 9
3 1 P3A 1 2 4
3 2 P3B 3 3 2
3 3 P3C 9 9 9
Basically, in columns L and M, I made two columns with index numbers. Voice numbers go from 1 to 3 and repeat every 3 rows because there are nv=3 voices (increase this if you have voices F, G, H...). Person numbers are also repeated for 3 rows each, because there are nv=3 voices.
To make the row headers (P1A, etc.), I used this formula: ="P" & L2 & CHAR(64+M2) at P1A and copied down.
To make the new table of values, I used this formula: =OFFSET(B$2,$L2-1,($M2-1)*3) at P1A-formal, and copied down and across. Note that B$2 corresponds to the cell address for P1-Aformal in the original table of values (your example).
I've used this indexing trick I don't know how many times to quickly rearrange tables of data inherited from other people.
EDIT: Note that the index columns are also made (semi)automatically using a formula. The first nv=3 rows are made manually, and then subsequent rows refer to them. For example, the formula in L5 is =L2+1 and the formula in M5 is =M2. Both are copied down to the end of the table.

Resources