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.
Related
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?
I've been struggling between the SUMPRODUCT and COUNTIFS formulas as there are a lot of specific dependencies in my data. Wondering if anyone can shed a bit more light on this issue.
Have tried SUMPRODUCT and COUNTIFS which give me calculations based on 1 set, but I need to include additional if/or statements.
I have the following:
| ID | Size | Dead/Alive | Duration | Days | Pass/Fil | Reason |
|----|---------|------------|-----------|------|----------|----------|
| 1 | Full | Dead | Permanent | 125 | Pass | Comments |
| 2 | Partial | Alive | Permanent | 500 | Pass | |
| 3 | Other | Dead | Temporary | 180 | Fail | Comments |
| 4 | No | Dead | Temporary | 225 | Fail | Comments |
| 5 | Yes | Alive | Permanent | 200 | Pass | |
with the following rules:
Only Count the ID/ROW if:
1) Values in column A = Full, Partial or Other
OR...
2) Values in column A = No AND values in column B = Dead
OR...
3) If values in column C = Permanent AND values in column D = >=100 or <=200
OR
4) If values in column C = Temporary AND values in column E = Pass, Fail AND column F=not blank
By my calculations, the total should be 5, but this is just a small sampling of my total data. Just not sure how to get that in Excel with either Sumproduct, Countifs or even someone suggested a Lookup function, although Ive never used that one.
Given that you have so many different conditions, I have to break it down one by one and create a few helper columns to account for each condition.
In my solution I created 10 helper columns as shown below, and I have added some sample data (ID 6 to 29) to test the solution.
I also named 7 conditions in my solution:
Cond_1 Values in column A = Full, Partial or Other
Cond_2 Values in column A = No AND values in column B = Dead
Cond_3A Values in column C = Permanent
Cond_3B Values in column D >=100
Cond_3C Values in column D <=200
Cond_3A, Cond_3B and Cond_3C must be TRUE at the same time
Cond_4 Values in column C = Temporary AND values in column E = Pass
Cond_5A Values in column C = Temporary AND values in column E = Fail
Cond_5B Column F is not blank (I did not give a name to this condition)
Cond_5A and Cond_5B must be TRUE at the same time
Please note my Cond_4, Cond_5A and Cond_5B are all related to your original condition 4), which reads a bit odd, and I am not 100% sure if my interpretation of the condition is correct. If not please re-state your last condition and I can amend my answer accordingly.
As shown in my screen-shot, the formulas in I2 to Q2 are listed in Column U. I only used MAX, AND, SUM, =, &, and/or <> to interpret each condition. Please note some of the formulas are Array Formula so you need to press Ctrl+Shift+Enter to make it work.
The To Count column is simply asking whether the SUM of the previous 9 columns is greater than 1, which means at least one of the conditions is met. If so returns 1 otherwise 0.
Then you just need to work out the total of To Count column. In my example it is 22. I have highlighted the entries that did not meet any of the given condition.
You can use only one helper column to capture all conditions in one formula, but I would not recommend it as it would be too long to be easily understood and modified in future.
{=--(SUM(MAX(--(A2=Cond_1)),MAX(--(A2&B2=Cond_2)),--(SUM(--(C2=Cond_3A),--(AND(D2>=Cond_3B,D2<=Cond_3C)))=2),MAX(--((C2&E2)=Cond_4)),--(SUM(MAX(--((C2&E2)=Cond_5)),--(F2<>""))=2))>0)}
Ps. I would also wonder if there is a formula-based solution without using any helper column...? :)
following problem:
Let's say my file looks like this:
Column A | Column B | Column C
ABCDEFI | 7000 | 50
ABCDEFI | 7500 | 20
ABCDIFE | 7000 | 30
ABCDEFI | 7500 | 80
I want to look for "ABCDEFI" in Column A and for "7500" in Column B and sum
up the corresponding values of Column C and store them in Column D.
In this case the end result should be "100" in Column D.
Hope that makes sense.
Happy to see read your answers.
Fairly simple SUMIFS() will work:
=SUMIFS(C:C,A:A,"ABCDEFI",B:B,7500)
Following is my data structure
A | B | C | D | E
Company Name| Year | First Trading (Year) | Suspended From (Year) | Suspended Till (Year)
| F |
| Year of Delisting |
I need to have corresponding values of A in column G, where if the year (column B) matches First Trading (Column C) and if it is true then any value of B would not be between column D and E. Moreover, if values of B are greater than values of F then it would return 0 in column G.
I had used If (B2>=C2,if(B2<F2,if(and(b2<d2,b2>e2),a2),0),0),0) in cell G2 but still no help?
It would be great help to me if anybody can rectify my statement or tell me a way to do it.
Many Thanks,
Sagnik
How about the following IF statement:
=IF(AND(B2=C2,OR(B2<D2,B2>E2)),IF(B2>F2,0,A2),0)
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