Thanks in Advance
My question is below:
I have 8 Columns in my sheet as below
Date | A | B | C | D | E | F | G | H | I
I want to plot 2 graphs for 10 latest entries
1st Graph contains Date, A, C, and H
and 2nd Graph contains Date, D, E, and I
What I was able to do is create a Defined Name for each column and add it but I feel this is a lengthy task.
To create Defined Name for each column I used =OFFSET(Sheet1!$D$2,COUNT(Sheet1!$D:$D),0,-10,1)
using which I am able to get the last 10 entries
What I want to achieve is, Instead of creating a Defined Name for each column is there any other way we can directly get the last 10 entries for all the columns for which I want to plot?
Related
I need help on creating a formula/code on data filtering.
I have 4 columns of data as below:
Column A Column B Column C Column D
__________________________________________________
| ID TEST FUNCTION SCRATCH |
|_________________________________________________|
|92018211 Y WELL |
|72937191 |
|01221921 WELL Yes |
|72901921 Y Yes |
|00192839 Y WELL Yes |
|_________________________________________________|
I want to filter my data into if any of the column B,C and D is blank, the data should be visible.
The data that have value in all three column B,C,D is the data that I do not want.
Example: Example the data that have value Y in column B, value WELL in column C, value Yes in Column D
So from my data above, after filter the data should be like below:
Column A Column B Column C Column D
__________________________________________________
| ID TEST FUNCTION SCRATCH |
|_________________________________________________|
|92018211 Y WELL |
|72937191 |
|01221921 WELL Yes |
|72901921 Y Yes |
| |
|_________________________________________________|
I would like to do the formula/code using excel macro Autofiltering.
Any help from anyone is much appreciated. Really hope anyone able to help me on this.
You could add a column E with the formula =OR(ISBLANK(D2),ISBLANK(C2),ISBLANK(D2))
This formula returns a FALSE when data is present all three columns (B, C, D)
After this you can apply a filter and delete the rows where column E is FALSE. This would you give you the desired result.
I would like to compare between few columns, what where the top 5 most popular products in year 2015.
I have this kind of data flow to work with:
Client | Product | Date of buy
------------------------------
client1 | A | 15.06.2015
client3 | A | 04.12.2015
client5 | F | 15.06.2015
client9 | G | 15.01.2015
client2 | G | 15.01.2015
client1 | R | 05.07.2015
client3 | G | 15.06.2015
client1 | F | 05.07.2015
client3 | F | 15.06.2016
Results - which products client bought the most with (in same date) the top 5 products communities of them. E.g..
1. Product A + Product H 222 times
2. Product A + Product E 77 times
3. Product B + Product O 70 times
4. etc
5. ...
Greetz,
Making the assumption:
you can use helper columns.
Your Columns up above are A, B and C.
You have two header rows and data starts in row 3.
Your dates are stored in an excel date format and not string values.
In E2 I generated a list of unique product items using the following formula:
=INDEX($B$3:$B$11,MATCH(0,INDEX(COUNTIF($E$2:E2,$B$3:$B$11),0,0),0))
I copied it down to match the number of rows in the initial list. It starts spitting #N/A when all the unique items in the list have been listed. If you want to avoid this you could put the formula inside of:
=IFERROR(insert formula,"")
Now in column F I did a count based on your criteria of each item and within the year 2015. I used a multiple count if function called COUNTIFS:
=COUNTIFS($C$3:$C$11,"<"&DATE(2016,1,1),
$C$3:$C$11,">"&DATE(2014,12,31),
$B$3:$B$11,E3)
I just reformatted that for easier reading. You will have to edit that slightly if you want to copy and paste. If you don't like seeing 0 when there is no product in the adjacent column you could wrap the equation in:
=IF(E3="","", insert formula )
I then skipped a column and sorted the list of counted items from largest to smallest and had it return the numbers in sequence. I only went down two rows, but you could technically do the whole list. The large function does this and the formula in H3 looks like:
=LARGE($F$3:$F$11,ROWS($1:1))
I then went back 1 column and put the product name that corresponds to the count, and then took the next name in the list when products had equal count. I put that in column F as normally when I read I want to read the product name first then read the quantity. If you want it the other way around just swap the columns. The formula in G1 is:
=INDEX($E$3:$E$11,MATCH(H3,$F$3:$F$11,0)+COUNTIF($H$3:$H3,H3)-1)
Copy E3 and F3 down as far as you need. Copy G3 and H3 down one row and you will have top two. down two rows and you have top three etc.
This is how it looks...The dates are displayed according to my computers date format.
I have a longitudinal spreadsheet of adolescent growth.
ID | CollectionDate | DOB | MOTHER ID | Sex
1 | 1Aug03 | 3Apr90 | 12 | 1
1 | 4Sept04 | 3Apr90 | 12 | 1
1 | 1Sept05 | 3Apr90 | 12 | 1
2 | 1Aug03 | 21Dec91 | 12 | 0
2 | 4Sept04 | 21Dec91 | 12 | 0
2 | 1Sept05 | 21Dec91 | 12 | 0
3 | 1Aug03 | 30Jan89 | 23 | 0
3 | 4Sept04 | 30Jan89 | 23 | 0
This is a sample of how my data is formatted and some of the variables that I have. As you can see, since it is longitudinal, each individual has multiple measurements. In the actual database there are over 10 measurements per individual and over 250 individuals.
What I am wanting to do is input a value signifying the number of older brothers and older sisters each individual has. That is why I have included the Mother ID (because it represents genetic relatedness) and sex. These new variable columns would just say how many older siblings of each sex each individual has. Is there a formula that I could use to do this quickly?
=COUNTIFS($B:$B,"<>"&$B2,$H:$H,$H2,$AI:$AI,$AI2,$J:$J,"<"&$J2)
Create a column named Distinct with this formula
=1/COUNTIF([ID],[#ID])
Then you can find all the older 0-sexed siblings like this
=SUMPRODUCT(([DOB]>[#DOB])*([MOTHERID]=[#MOTHERID])*([Sex]=0)*([Distinct]))
Note that I made the data a Table and used table notation. If you're not familiar [COLUMNNAME] refers to the whole column and [#COLUMNNAME] refers to the value in that column on the current row. It's similar to saying $A:$A and A2 if you're dealing with column A.
The first formula gives you a value to count that will always result in 1 for a particular ID. So ID=1 has three lines and Distinct will result in .33333 for each line. When you add up the three lines you get 1. This is similar to a SELECT DISTINCT in Sql parlance.
The SUMPRODUCT formula sums [Distinct] for every row where the DOB is greater than the current DOB, the Mother is the same as the current Mother, and the Sex is zero.
I have a possible solution. It involves adding two columns -- One for "# older siblings" and one for "unique?". So here are all the headings I have currently:
A -- ID
B -- CollectionDate
C -- DOB
D -- MOTHER ID
E -- Sex
F -- # older siblings
G -- unique?
In G2, I added the following formula:
=IF(A2=A1,0,1)
And dragged down. As long as the data is sorted by ID, this will only display "1" once for each unique person.
In F2, I added the following formula:
=COUNTIFS(G:G,"=1",D:D,"="&D2,C:C,"<"&C2)
And dragged down. It seemed to work correctly for the sample data you provided.
The stipulations are:
You would need the two columns.
The data would need to be sorted by ID
I hope this helps.
You need a formula like this (for example, for row 2):
=COUNTIFS($A:$A,"<>"&$A2,$E:$E,$E2,$D:$D,$D2,$C:$C,"<"&$C2)
Assuming E:E is column for sex, D:D is column for mother ID and C:C is column for DOB.
Write this formula in H2 cell for example and drag it down.
I have over 100k rows of data like below:
ALLA,ALLA,"Company1, Inc.","Company1, Inc.",PSA,PSA,1,1,FALSE,FALSE
BCCO,BCCO,"Company2, Inc.","Company2, Inc.",PSB,PSB,1,1,FALSE,FALSE
CTTP,CTTP,"Company3, Inc.","Company3, Inc.",PSC,PSC,1,1,FALSE,FALSE
CMMZ,CMMZ,"Company4, Inc.","Company4, Inc.",PSD,PSD,1,1,FALSE,FALSE
I want to know how to figure if data in column 1 is the same as column 2, column 3 as column 4 and so on. How could I do that in excel?
Following Cory's formula, I found that I can compare whole columns using:
=if(A:A=B:B, "yay", "aww")
Problem is I have a header in the file:
c - symbol, symbol, c - companyname, companyname, c - tradingvenue, tradingvenue, c - tierrank, tierrank, c - iscaveatemptor, iscaveatemptor
Shouldn't this cause A:A=B:B to be false?
Given this:
| A | B |
---+-----+-----+
1 | X | X |
---+-----+-----+
2 | Y | Y |
---+-----+-----+
3 | Z | Z |
The formula =SUMPRODUCT(--(A1:A3=B1:B3)) will tell you how many times the A value matches the B value.
You should get 3 as a result here. If, for example, you change B3 to Q then it will give you 2.
To do this on two columns without specifying the end of the range, try:
=SUMPRODUCT(--(A:A=B:B),--(LEN(A:A)>0))
I've been using Excel since 1991, and unless you want to write a VB macro, I think the best way is to do the simple IF statement suggested in the comments. If you need to test several columns at once, which is what your question suggests, then I'd do
=IF(AND(A1=B1,C1=D1,E1=F1,G1=H1),0,1)
Fill that formula down the column and then you'll be able toinstantly count the number of rows that don't matchwith a data-filter, select all the rows which have a '1', so you'll be able to examine the rows that don't match
I am trying to sort data imported from a csv file. The data comes in like such:
Columns
A | B
--------
t1 | 1
t3 | 9
t1 | 2
t2 | 5
t1 | 1
t3 | 13
t1 | 3
t3 | 11
t2 | 4
t2 | 7
t3 | 10
t3 | 10
and i want output similar to this:
Columns
D | E | F
----------------
t1 | 1 | 3
t2 | 4 | 7
t3 | 9 | 13
Explanation: Basically what I need to do is find the lowest and highest values from column B for each different value in column A, and list them neatly as shown in the second example.
Ive worked with VBA before, so if this would have to be done via VBA thats fine. Im just at a loss as to how to accomplish this task. Any help would be appreciated.
EDIT: Forgot to mention, if would make the task simpler, its fine if i have to manually sort the data alphabetically based on col A (thus putting same values together)
I agree with #chrisneilsen that a Pivot Table is the best way to go. If you are set on using formulas, you can try using the following (both entered as arrays - Ctrl+Shift+Enter):
In cell E1, which will represent the minimum value:
=MIN(IF($A$1:$A$12=D1,1,MAX($B$1:$B$12)+1)*$B$1:$B$12)
And in cell F1, which will represent the maximum value:
=MAX(IF($A$1:$A$12=D1,1,MIN($B$1:$B$12)-1)*$B$1:$B$12)
The general idea is that check to see which values in column A are equal to your target value (column D). The result will be an array of 1's where there is a match, and using MIN as an example, the maximum of the column + 1. This is done because we want to set this equal to a value that can't possibly be attained in your current setup, so the maximum value + 1 will ensure that MIN will return a value that is legitimate.
Here is a Pivot Table using Excel 2007. To create, add column headers to your data, select your data and then in the Ribbon click Insert -> Pivot Table. In the dialog box, you decide where you want to put it (it is commonly put in a New Worksheet, so you can leave the default if you want - I left it in the same worksheet for illustration purposes). From there, you can arrange it by dragging each field so it matches the pictures. For the Max/Min fields, just drag the Value field into the Values section twice. Then, in the actual Pivot Table, you can right-click on one of the values in the column and select Summarize Data By -> Min to summarize by the minimum value for each key: