I have written a formula to check if a small range has a date in the cells. My data looks like this:
+----------+------------+
| Proposed | Dates Used |
+----------+------------+
| 0 | 9/23/2019 |
| 0 | 9/24/2019 |
| 0 | 9/25/2019 |
| 0 | 9/26/2019 |
| 0 | 9/27/2019 |
| 0 | 9/29/2019 |
| 0 | 9/30/2019 |
| 1 | 10/2/2019 |
| 1 | |
| 0 | |
+----------+------------+
My current formula looks like this: =COUNTIFS(Propsed_Days,0,Dates_Used,"<>0")
This returns an error. I have also tried =COUNTIFS(Propsed_Days,0, Dates_Used,"<>"), which also returns an error. (I am using defined names to cover the ranges, right now Propsed_Days covers both columns and Dates_Used covers just the date column)
Basically what I want is to get a count of dates that have the Proposed column = 0, but don't want to count when there is no date but proposed is = 0. My table above should = 7 because there are 7 dates that have a proposed = 0 the date with the proposed = 1 should be excluded and the 2 lines (one with Proposed = 0 and one with Proposed = 1) should be excluded because there are no dates in the Dates Used column.
I have tried searching for a solution and tried answers from Using COUNTIFS to count blank when cell has a formula and How do I get countifs to select all non-blank cells in Excel?, but neither questions answers have worked for me.
The named range "Proposed Days" will cause the issue since this is for both columns, you need to adjust this to only cover the first column.
Once you've done that you need to concatenate the condition like so.
=COUNTIFS(Proposed_Days,0,Dates_Used,"<>"&0)
The following formula will work ONLY IF the last two cells in your Dates_Used column is completely blank but not a blank returned by a formula.
=COUNTIFS(Propsed_Days,0,Dates_Used,"<>")
I suspect the dates in your Dates_Used column are returned by a formula so the blank cells are not really blank. If that's the case, the following SUMPRODUCT formula will do the job:
=SUMPRODUCT((Propsed_Days=0)*(LEN(Dates_Used)>0))
Cheers :)
Related
I have a sheet where I am recording what I eat:
Another where I keep an index of values to lookup
I tried
=SUM(VLOOKUP('Sheet1'!A2:A11,'Sheet2'!A2:E11,2,FALSE))
but that only returned the first match, so then I tried
=SUMPRODUCT(SUMIF('Sheet1'!A2:A11,'Sheet2'!A2:A11,'Sheet2'!B2:B11))
but that isn't working either.
does anyone have a solution, where I can also multiply the value of the return match by the # of servings in the first sheet?
Thanks!
If you want a single output of calories through SUMPRODUCT then you can use
=SUMPRODUCT(B2:B11*IFERROR(VLOOKUP(A2:A11,Sheet2!A2:B11,2,0),0))
If you are sure that all entries on Sheet 1 can be located on Sheet 2 then you can drop IFERROR portion like
=SUMPRODUCT(B2:B11*VLOOKUP(A2:A11,Sheet2!A2:B11,2,0)).
Beware that if a value is not found in Sheet 2 then formula will produce wrong result as IFERROR will multiply the serving quantity with 0.
I combine 2 tables into one sheet, Table 1 housed in Column A & B and Table 2 housed in Column D & E
In G2, "Total Serving Colories" enter formula :
=SUMPRODUCT(VLOOKUP(T(IF({1},A2:A12)),D2:E12,2,FALSE)*B2:B12)
It's not super-clear what you're trying to get at. But defining the "Calories Per Serving" in a range called "cals",
+---+---------+-----+--------------------------------+
| | A | B | C |
+---+---------+-----+--------------------------------+
| 1 | egg | 3 | =(VLOOKUP(A2,cals,2,FALSE))*B2 |
| 2 | oatmeal | 1.5 | =(VLOOKUP(A3,cals,2,FALSE))*B3 |
| 3 | shrimp | 2 | =(VLOOKUP(A4,cals,2,FALSE))*B4 |
+---+---------+-----+--------------------------------+
Results in:
I need to answer the question of how many parts were successful by counting the distinct Part Labels where PartName matches, and the sum of LabelFailures = 0.
PartName | PartLabel | LabelFailure
---------+-----------+-------------
a | 1 | 1
a | 1 | 0
a | 2 | 0
a | 2 | 0
b | 1 | 0
Desired Results:
PartName | PartsLabelSucceeded
---------+--------------------
a | 1
b | 1
This question might be similar to these two, but I'm having a hard time holding the individual components in my head to apply the answers to this particular situation. I've been trying to use COUNTIFS, but haven't found a way to fit both criteria in correctly.
Excel Count Unique Values on Multiple Criteria
Excel Count Distinct Values with Multiple Criteria
Use a helper column.
In D2 put:
=(COUNTIFS($A$1:A2,A2,$B$1:B2,B2)=1)*(COUNTIFS(A:A,A2,B:B,B2,C:C,1)=0)
Then insert a pivot table with PartName as the Rows And Count in the Values.
OR List the PartName manually and use SUMIFS:
=SUMIFS(D:D,A:A,G2)
This can also be done with a formula, without the helper if one wants to list the partNames:
=SUMPRODUCT((($A$2:$A$6=F2)*(COUNTIFS(A:A,$A$2:$A$6,B:B,$B$2:$B$6,C:C,1)=0)/(COUNTIFS(A:A,$A$2:$A$6,B:B,$B$2:$B$6)+($A$2:$A$6<>F2)+(COUNTIFS(A:A,$A$2:$A$6,B:B,$B$2:$B$6,C:C,1)>0))))
I have an excel document with a checklist like this one:
| number | yes/no | notes |
| 1 | yes | blablabla |
| 2 | yes | twinkle twinkle |
| 3 | no | little star |
I'd like to "echo" the fields which are set as "no" (in the second column) in another sheet, echoing the columns "number" and "notes". The result of my example would be:
| number | notes |
| 3 | little star |
How could I do it? Thanks!
Assuming your Main Table is in Sheet2, range A2:A4 (row 1 being headers). Use this formula, as an array (enter with CTRL+SHIFT+ENTER) in your sheet 2:
=INDEX(Sheet2!A$2:A$4,SMALL(IF(Sheet2!$B$2:$B$4="No",ROW(Sheet2!A$2:A$4)-ROW(Sheet2!A$2)+1),ROWS(Sheet2!A$2:A2)))
This will return all the Numbers. To get the Notes, change the very first index range to Sheet2!C$2:C$4. Obviously adjust your range down as necessary (I doubt you only have 4 of these).
Finally, just wrap an IfError() around that, so it looks nice when you use it. As you add data to your table, your table of only "no" values will update.
=IfError(INDEX(Sheet2!A$2:A$4,SMALL(IF(Sheet2!$B$2:$B$4="No",ROW(Sheet2!A$2:A$4)-ROW(Sheet2!A$2)+1),ROWS(Sheet2!A$2:A2))),"").
edit:
Screenshots:
(Using the IfError([above formula],"") wrapper hides the #NUM results when there's no match.)
What I'm trying to accomplish doesn't seem too tricky, and should be doable I just can't seem to crack it.
All I need to do is create a calculated column that flags whether or not the row value in one column exists anywhere in another column within the same table.
id | Code 1 | Code 2 | Attempted results
--------------------------------------------------------------------------
1 | 1095829 | 1093895 | Y
2 | 1093895 | 1838949 | N
3 | 1095289 | 1093910 | Y
4 | 1093910 | 1840193 | N
So essentially, is Code 1 found anywhere in the code 2 column
You should be able to do this using an IF/MATCH formula. For example:
=IF(MATCH(B2,C:C,0),"Duplicate", "Unique")
This would check if B2 (1095829) shows up anywhere in the C column. If it does, it returns "Duplicate" to that cell, if it does not, then it returns "Unique".
To make it easy
+---+----+-------------+
| | A | B |
+---+----+-------------+
| 1 | xx | 12-05-2015 |
| 2 | xx | 15-05-2015 |
| 3 | yy | 13-05-2015 |
| 4 | yy | 16-05-2015 |
+---+----+-------------+
(today is 14-05-2015)
I need to get the MAX date value for each "A" value only if it is before today.
In case it's not, move to the 2nd biggest value. Case it does not find, empty cell.
What I've done so far:
=MAX($A$1:$A$4='xx';$B$1:$B$4<TODAY();$B$1:$B$4)
and confirm with SHIFT+CTRL+ENTER
The error I get is that it yields 13-05-2015 as max value for xx, which is obviously wrong (as if it does not take into account the $A$1:$A$4='xx'
You need to use nested if-functions. I.e. change your formula into:
{=MAX(IF($A$1:$A$4="xx", IF($B$1:$B$4<TODAY(), $B$1:$B$4)))}
And end it with Ctrl+Shift+Enter
A standard (non-array) formula alternative.
=MAX(INDEX((B:B)*(A:A="xx")*(B:B<TODAY()), , ))
This formula would benefits from having its cell ranges cut down from full columns to something closer to the usable data range.
If your dates are sorted ascending as shown in the example then you can use LOOKUP like this:
=LOOKUP(2,1/(A$1:A$100="xx")/(B$1:B$100<TODAY()),B$1:B$100)
Doesn't require "array entry"