Excel: AND formula when using multiple datasets of different lengths - excel

I have two datasets: both have an id column and a date column.
Dataset A can have multiple date entries (rows) per id - i.e., it is a long dataset
Dataset B only has one date entry per id
The two datasets are in a single spreadsheet:
Columns A and B are the id and date for dataset A
Columns E and F are the id and date for dataset B
I am trying to use the =AND formula in Excel to determine which rows in Dataset A match exactly to their respective row in Dataset B.
Example
Here is a toy example with the desired results in Column C.
How should this be coded?
I assumed that the following formula in column C (e.g., C2=AND(A2=E:E,B2=F:F) would return TRUE when the exact match occurs; however, the formula returns FALSE in all cells.

So my method is pretty lengthy but here's the code
I put this under C2
=IF(ISNA(VLOOKUP(B2,F:F,1,FALSE)), "FALSE", "TRUE")
So basically VLookup looks at B2 and checks if its in the F column.
If it isn't it returns N/A, if it is, it returns the date value.
So if the value is N/A, it will return "FALSE", which in C2 it does return.
It should return "TRUE" for the corresponding true values.
The third parameter is 1 by default since F:F has only 1 column.
There's probably more elegant solutions but I hope that helps!

Related

VLOOKUP formula... is this the right formula for what I am trying to accomplish?

I want to lookup a specific date from cell E2 within a list of dates (column A) and return the corresponding value in column B from the matching date values IF column D does not equal "NA". I want the column of revised dates (RevDate column) to coincide with the specific Q measurement when the tss data was <> "NA". This will give me the specific Q value when tss was measured on a specific date.
Formulas I have tried in Excel:
=IF(D2<>"NA",VLOOKUP(E2,$A$2:$D$445196,4,FALSE),0)
=IF(VLOOKUP(E2,A$2:D$445196,2,FALSE)="NA","",)
I feel I am close.... maybe????
If you are going to have per date in A column just a single value in column D that is not NA(as per your sample), then you can use FILTER. VLOKUP will return the first match, and this is not what you want.
=FILTER($B$2:$B$445196, ($D$2:$D$445196<>"NA") * ($A$2:$A$445196=E2))
In case FILTER returns multiple rows, you would need to concatenate the result as follow:
=TEXTJOIN(",",,FILTER($B$2:$B$445196, ($D$2:$D$445196<>"NA")
* ($A$2:$A$445196=E2), "Not Found"))
Added also not found condition (if not it returns #N/A), that covers the case of 10/3/2010 for example. You can replace with an empty string as per in your second formula.

How to sum corresponding values with same month and names of two columns in Excel?

The formula should sum up the column C based on Column A and B when two column value matches and displays the sum value only in the first cell D2 of Column D as shown in figure "60" & "67".
I am trying with SUMIFS but not getting the Output as required.
=SUMIFS(C2:C6;A2:A6;"A:A";B2:B6)
Try this formula in cell D2:
=IF(SUMPRODUCT(--($A$2:$A2&$B$2:$B2=$A2&$B2))=1,SUMPRODUCT(--($A$2:$A$6&$B$2:$B$6=$A2&$B2),$C$2:$C$6),"")
It should give expected output.
It might also be better/more efficient if you create a helper column (which stores concatenation results, instead of doing the concatenation multiple times in each formula).

How to match same values in three columns and display a value of 3rd column into new column using Excel?

I have a excel sheet where I need to match the values of Columns "A","B","C" and return a duplicate value of Column "C" as one value into Column "D" . The similar columns are Team, Month, Value. The fourth column is called "Actual Value" here the matching and repeated value should appear based on Column A.
Excel table:
The formula I tried :
=IF(A3=B3;C:C;"C3")
but this is not giving the Output.
Put this in D3 and copy down:
=IF(OR(A3<>A2,B3<>B2),C3,"")
This assumes your data is sorted on A then B as your example shows.
It test whether the data changes from the line above. If true then it returns the value. If false it returns an empty string.

Excel formula to calculate the sum of the first n% visible rows in a filtered column

As I stated in the title, I want to calculate the sum of the first n% rows in a filtered column. The total numbers of rows in the column varies due to the filtering options, so my formula must work with different values of n.
For example :
In column A, I have 10 rows that contain values from 10 to 1 ( I sorted them from largest to smallest ).
In column B, I have 10 corresponding rows that contain 2 names: 4 of them contain the value "Tom", six of them contain the value "Jerry". When I filter the whole table and select only the rows that contain the value "Jerry", I want to be able to calculate the sum of the first 20% of the corresponding 6 number values.
This could work without any filtering if you want.
With criteria for column B in E1 and percentage you looking for in F1 with the assumption we want to round up the percentage to integers.
So formula in D1:
=SUMPRODUCT(LARGE((B2:B11=E1)*(A2:A11),ROW(A1:INDEX($A:$A,ROUNDUP(COUNTIF(B2:B11,E1)*F1,0)))))
So, without your data, I came up with this, edit to suit your situation...
So, based on the comment, I did a second version:
The helper column in col C is used with sumproduct to give the result...
You can use the percentile function in AGGREGATE with SUMIFS to do what you want:
=SUMIFS(A:A,B:B,"Jerry",A:A,">="&AGGREGATE(16,7,A1:A10/(B1:B10="Jerry"),0.8))
If you want to use the filter to do the decision:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1,ROW(A2:A10)-1,,1))*(A2:A10>=AGGREGATE(16,7,A2:A10,0.8)),A2:A10)

Sum column of values where separate column contains duplicate

I need to sum all values in Column A where Column B is a duplicate.
Above is a sample of the data. Column B has urls and Column A has counts for the urls. What I want is to sum the values in Column A for duplicate values in Column B.
Example:
The output for _.apelabs.net should be 6.
How can I achieve this?
I think you are looking for the function =COUNTIF(Range,Criteria)
Here is a link that shows a usage example.
As #Andresson stated, if you're trying to count the number of times a specific url appears, you might want to use the COUNTIF function: =COUNTIF(range, criteria).
COUNTIF Example:
Using =COUNTIF(B:B, "_.apelabs.net")
would return 3 in your sample data (assuming your image includes the only instances of "_.apelabs.net").
This example of the COUNTIF function is the same as saying, "count the total number of times a cell in Column B (i.e. B:B) equals "_.apelabs.net"."
However, if you're wanting to sum together all the values in Column A where the corresponding url in Column B matches the given criteria, you'll want the SUMIF function: =SUMIF(range, criteria, [sum_range]).
SUMIF Example:
Using =SUMIF(B:B, "_.apelabs.net", A:A)
would return 5 in your sample data (again assuming your image includes the only instances of "_.apelabs.net").
This example of the SUMIF function is the same as saying, "each time a cell in Column B (i.e. B:B) equals "_.apelabs.net", sum together the values in Column A (i.e. A:A) that are located in the same row as each "_.apelabs.net" found in Column B."
Additionally, you can also use a pivot table, as #ScottCraner suggested. It's all a matter in how you want to present your findings.

Resources