How to count row based on 2 sheets - excel

I have 2 sheets named A & B.
A has 3 columns (ID, Date, Name) and B has 3 columns (ID, Status, Level). A.ID and B.ID are same.
I want to count the status(two information “Done” or “Not Done”) based on A.Date range.
My Formula is:
=COUNTIFS(A!A2:A1048576,B!A2:A1048576,A!G2:G1048576,">=01-01-2020",A!G2:G1048576,"<=30-06-2020", B!B2:B1048576, “Done”)
But every time it shows 1. By manual filter it shows 12.

Adding a column (i.e. F) with formula: =A2=B!A2, and doing:
I created a 'sample' with only 17 rows, and i use ';' a separator in formula's (😕)
=COUNTIFS(B!B2:B17;"=Done";A!B2:B17;"<=01-08-2020";A!B2:B17;">=01-02-2020";F2:F17;"=TRUE")
CriteriaRange1: B!B2:B17
Criteria1 : "=Done"
Only count values that are "Done"
CriteriaRange2: A!B2:B17
Criteria2 : "<=01-08-2020"
Only count when date is (on or )before 1 August
CriteriaRange3: A!B2:B17
Criteria3 : ">=01-02-2020"
Only count when date is (on or )after 1 Februari
CriteriaRange4: A!F2:F17
Criteria4 : "=TRUE"
The formula in F checks if A!A2 is equal to B!A2 (for all rows)
I do hope there is an easier way to do the Criteria4 😉

Related

Excel two column and condition

I have a column with dates like so where w represents weeks and d represents days.
Column1 Column2
in 1w3d out 1w5d
in 2w0d out 3w0d
in 24w2d out 23w0d
in 1w0d out 1w2d
Basically what I want to do is to check if both dates in Column 1 and Column 2 are between 1 week and 24 weeks. Both column values must be within the range.
Thus the output would be
Column1 Column2 Column3
in 1w3d out 1w5d Between 1 week and 24 weeks
in 2w0d out 3w0d Between 1 week and 24 weeks
in 24w2d out 23w0d Not between
in 1w0d out 1w2d Not between
I have an if statement for this written in excel that is like so
=IF(AND(A2>"in 1w0d,A2<"in 24w0d",B2>"out 1w0d,B2<"out 24w0d"),1,0)
However this does not get the desired results
Column3=MID(A2,SEARCH(" ",A2),SEARCH("w",A2)-SEARCH(" ",A2))*7+(MID(A2,LEN(A2)-1,1))
Column4=MID(B2,SEARCH(" ",B2);SEARCH("w",B2)-SEARCH(" ",B2))*7+(MID(B2,LEN(B2)-1,1))
Column5=IF(AND(C2>7,C2<24*7,D2>7,D2<24*7),1,0)
Maybe you need C2>=7 etc depending on where to draw the line

Count of Excel based on 2 column criteria and counting the 3rd column

I need a count of how many date items fall within Data 1 & Data 2
ie:
x-1 will have a count of 2
x-2 will have a count of 1
-x-3 will have a count of 2
-y-1 will have a count of 2
What would be the best way to go abouts when approaching this?
Data 1
Data 2
Date
x
1
Date 1
x
1
Date 1
x
1
Date 2
x
2
Date 3
x
2
Date 3
y
1
Date 1
y
1
Date 1
I see only one way to interpret with the available information:
To count the number of times Date_to_test falls within Date_1 and Date_2 (screenshot below, sheet here), you could use either the sum or something like a countifs (with interim calc):
sum approach
=SUM(1*($C$2:$C$11<=$B$2:$B$11)*($A$2:$A$11<=$C$2:$C$11))
countifs + interim calc
helper
=1*(C2<=B2)*(A2<=C2)
(additional column, drag down)
countifs
=COUNTIFS($D$2:$D$11,1)
Screenshot
Alternative
as for the 'sum' approach, sumproduct variants (e.g. =SUMPRODUCT(1*($C$2:$C$11<=$B$2:$B$11),1*($B$2:$B$11>=$A$2:$A$11))) are calculation/memory intensive
despite the countifs + helper approach containing more 'visible' data - these values need only be calculated once, the countifs can then be determined independently (assuming no updates to the helper column) - thus making it more memory/calculation efficient depending upon your calculation mode, screen-updating preferences
Caveat
if, by some misfortune re: interpreting your question, you are referring to some other means of establishing whether "date items fall within Data 1 & Data 2", then without knowing what this is, there very low likelihood of being able to guess this correctly

List result of lookup A in B, B in C without helper column

I have 2 tables:
Table1 containing Customer & Part#
Table2 containing Part# & Type
(The actual data lists are larger)
Table1 (Customer & Part#) & Table3 (Helper):
Customer
Part#
Helper
A
1
X
B
2
Y
C
3
X
A
4
Y
A
5
X
A
5
X
A
2
Y
Table2:
Part#
Type
1
X
2
Y
3
X
4
Y
5
X
Desired result for combination of customer A and Type X:
Part#
1
5
5
These being the 3 results of part numbers in Table1 that are Customer A and the lookup of the Part# results in Type X (see also Helper column).
I'm able to retrieve the results by creating the helper column as shown in the example data, however I want to skip this column and solve it in one go. But I don't know if that's even possible.
I was thinking about something in this direction.. =INDEX (Table1[Part'#],IF(Table1[Customer]="A",ROW(Table1[Customer]))
..but there I get stuck. I think I can pickup from there with IF, ISNUMBER, SEARCH but my head errors there.
Does anybody know a way to skip the helper column for this?
PS I have office365, but FILTER is not yet released by company rules (unfortunately).
PS I prefer a formula solution, but VBA is allowed when necessary
Here is a formula solution for Excel version 2010 to 2019
In I3, formula copied down :
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(A$3:A$9)/(VLOOKUP(N(IF({1},B$3:B$9)),D$3:E$7,2,0)=H$3)/(A$3:A$10=G$3),ROW(A1))),"")

Convert sql to excel formula

I have 2 tables in excel.
Table 1
Item Quantity_Required Quantity_Remaining
A 5
B 10
C 3
Table 2
Source Item Quantity
1 A 2
2 A 1
1 B 5
My result should be to fill in Quantity_Remaining column in Table 1
Table 1
Item Quantity_Required Quantity_Remaining
A 5 2
B 10 5
C 3 3
The logic in SQL code is as follows.
SELECT A.Item,
A.Quantity_Required,
A.Quantity_Required - B.Quantity as Quantity_Remaining
FROM Table1 A
LEFT JOIN
(SELECT Item,
SUM(Quantity)
FROM Table2
GROUP BY Item) B
ON A.Item = B.Item
I need pointers on how to translate this to Excel.
For data placed in excel sheet like below, you can use this formula:
=$B2-SUMPRODUCT(($A2=$B$8:$B$10)*($C$8:$C$10))
So the second part of formula SUMPRODUCT is looking for cells in range B8:B10 which match with A2 and then taking their values from column C and adding them.

How to find values in one column in another column with multiple values

I have an excel like
A B START DATE END DATE
1 10 01-jan-2016 02-jan-2016
2 11 01- jan-2051 02-feb-2061
3 1 04-mar-2016 07-mar-2016
4 1 08-mar-2016 10-mar-2016
5 5 01-mar-2016 03-dec-2016
6 5 03-nov-2016 31-dec-4712
I am new to excel. I want to highlight or extract the columns in A column which can be found in B Column along with the start date and end date .
That is result should be like :
A start_date end_date
1 04-mar-2016 07-mar-2016
1 08-mar-2016 10-mar-2016
5 01-mar-2016 03-dec-2016
5 03-nov-2016 31-dec-4712
Can anyone pls suggest something ?
In E2 enter:
=IF(COUNTIF(A:A,B2)>0,"X","")
and copy down. Then filter the table
You can hide any un-wanted columns after that.

Resources