Excel - SUM Columns IF column header is EQUAL to while another column header is EQUAL to BUT value is not 0 - excel

I have a table like this:
January February March Year to Date
Actual | Target Actual | Target Actual | Target Actual | Target
100 | 100 50 | 100 0 | 100 150 | 200
What I basically want to achieve is for Year to Date to SUM Target if Actual of each month is greater than zero (0).
Can this be achieved via Excel Formulas?

=SUMPRODUCT(B3:G3,((A3:F3)>0)*1,(B2:G2="Target")*1)
I am assuming that you can use column to the left of your data. If you can't just skip January in the sumproduct and add it with a simple IF.

Aaa +1 to this would be easier if you could re-arrange data.
The SUMIF function is helpful here.
Are you able to use an additional row? If not, is your Target always 100?
Assuming yes to one of these, the below will work. Highlighted cells have highlighted equations.
To calculate YTD Target: Green uses extra row 4, orange assumes target is always the same (100)
NB: the empty column A is so that the same equation canbe used in all cells on row 4. You can get rid of it and the equation in B4 without anything messing up.

Related

How if capture particular cell value

I have entered a date in Column A and column B.
Column A | Column B | Column C
---------------------------------------
23/9/2019 | 19/9/2019. |
Now i am trying to get date in a column c which is greater. Which formula should I use?
Use the MAX() worksheet function. It will give you the greater (that is, the larger or most recent) of the two values.
Just make sure the values are true Excel dates and not text values.

In Excel how to count between date1 and date2 that have cells in row that contain text?

I need to choose cells in one column that are between two dates, and then based on the rows that contain those dates, choose cells in another row that also contains content.
I didn't use ISBLANK because it counts a formula yet an empty cell as a not-blank. Instead check if there is content by "*".
Here is what I came up with, but instead of returning the number of cells, instead this returns TRUE (which obviously isn't what I want).
In the formula below I am assuming:
C:C is the whole column containing DATES.
E:E is the whole column containing CONTENT.
The date range in this case is January 1, 2018 to January 31, 2018.
"*" means is there is content in the cell
=IF(AND(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&"2018-1-31"),COUNTIF(E:E,"*"))=0,"",AND(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&"2018-1-31"),COUNTIF(E:E,"*")))
My goal is to:
count the numbers of the cells in column E that are between the dates in column C
if the whole formula is 0, then return a blank.
See this picture of a sample excel sheet to make my intent clear:
How can I get my formula working so it does as needed?
SOLUTION
Hi all, so thanks to #girlvsdata, we have a working solution. I had to do a couple edits to her code to work for my uses, but her formula overall works perfect. Here is the solution:
To choose all cells in column E that are not blank, in between the date range of all of January (unknown end date) based on the adjacent C column if that is your date column, then the solution is:
=IF(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&EOMONTH("2018-1-1",0),E:E,"*")=0,"",COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&EOMONTH("2018-1-1",0),E:E,"*"))
Note that "2018-1-1" is January 1 2018, and EOMONTH("2018-1-1",0) is the last valid day of January in the year 2018 (in this case, 31, but if it is different another year (e.g. for February this works for leap years too) then it will be that last day). Also it eliminates the need to calculate which is the last day or every month, as well as months that have changing end dates dependent on the year (e.g. Feb). This is important to eliminate a margin of error.
The only thing you have to do to change the month is only change e.g. -1- (Jan) to -2- for Feb, or change the year for other years. With this formula you can ignore the day part.
If the answer is 0 (no cells have any content in between the range), then the cell is blank instead of 0. (GOod for when you want to create a sheet checking future dates for future reference when more rows are added to the sheet.
It also works across different sheets, just use, say your other sheet is called "Tracker" then use Tracker!C:C and Tracker!E:E. Hope it helps!
Thank you all! :D
(Please note: My local date format is day, then month)
With the data laid out as in your example above:
A B
1 Dates |Content
------------+-------
2 1/01/2018 |
3 2/01/2018 |123456
4 3/01/2018 |
5 4/01/2018 |12398
6 5/01/2018 |484
7 6/01/2018 |1538
8 7/01/2018 |
9 8/01/2018 |
10 9/01/2018 |
11 10/01/2018 |14648
12 11/01/2018 |
13 12/01/2018 |145615
14 13/01/2018 |
And with the date range in cells D2 and E2:
Date Start Date End
2/01/2018 7/01/2018
This formula returns the count:
=COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0")
This will depend on whether your numbers in Column B are formatted as text or number. If they are formatted as numbers, the above formula will work. If they are formatted as text, replace the last section ">0" with "*".
This formula adds the conditional part of your question:
=IF(COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0")=0,"",COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0"))
(If the formula returns 0, show blank)

COUNTIF range does not equal range

The data I'm looking to get is something like this:
+----------+-------+
| Location | Count |
+----------+-------+
| Jungle | 2 |
| Ocean | 4 |
| Other | 2 |
+----------+-------+
The formula for count should look in the data range and if a cell's data does not equal any of the cell data in the rest of the location column (Jungle, Ocean) it should add that to the count. It should exclude blanks.
This is the formula I tried:
=COUNTIF(A1:H6,"<>"&E11:E12)
Here is my example sheet: https://docs.google.com/spreadsheets/d/1YbqEwa3olEXMcmU-UORfe7jwyK_-AXDomp1t5iTVUaU/edit?usp=sharing
Where am I going wrong? There are 7 other instances of colours not Green or Blue therefore I would expect this result to be output. I haven't put anything in about ignoring spaces so I would expect the result to count blanks too, but I get 0.
Don't use & - this would join E11 and E12 together so you would be looking for greenblue. You would need a COUNTIFS to get the three conditions
=COUNTIFS(A1:H6,"<>"&E11,A1:H6,"<>"&E12,A1:H6,"<>")
Here is a more general way of doing it
=COUNTA(A1:H6)-SUMPRODUCT(COUNTIF(A1:H6,E11:E12))
See this useful reference
The COUNTIFS formula is your friend here. This formula should work for that cell:
=COUNTIFS(A1:H6,"<>"&E11,A1:H6,"<>"&E12,A1:H6,"<>")
The problem with a 'does not equal OR does not equal' is that when it is not equal to one, it could be equal to the other and vice-versa. Additionally, you range to count from is 2 dimensional so you cannot use rows of criteria. Use SUMPRODUCT and individual criteria multiplied against each other.
=SUMPRODUCT((A1:H6<>"")*(A1:H6<>E11)*(A1:H6<>E12))
Any of those three conditions that is not true is considered zero. Anything multiplied by zero is zero. 1 x 1 x 1 is 1.
For large numbers of exclusions, you will want to use an array formula (with CSE) to count them and then subtract that total from a COUNTA total of the entire range.
=COUNTA(A1:H6)-SUM(COUNTIF(A1:H6,E11:E15))

Use Excel SUMIF to add cells with custom number formatted dollar value

I have a range of cells that contain dates and dollar amounts. I'd like to total the cells with dollars.
The worksheet is formatted in columns like this:
Date | Amount |Date | Amount | ... for about 20 col.
| | | |
| | | |
| | | |
I've tried various versions of SUMIF but I can't get a formula that will ignore the dates and include the dollar values. The dollar value cells have a custom number format that includes a $ sign. But I haven't been able to get anything that can use the $ to distinguish the 2 types of cells. Any suggestions?
The actual numerical value may be useful but it will depend upon the nature of your data (which is conspicuous by its absence).
A day is 1. A Date is 1 for every day past 31-Dec-1899. Today happens to be 42,537 and one year ago was 42,171. If no valid amount was larger than $40,000 then you can reliably use the SUMIF or SUMIFS function by discarding numerical amounts greater than EDATE(TODAY(), -12).
=sumif(a:z, "<"&edate(today(), -12), a:z)
=sumifs(a:z, a:z, "<"&edate(today(), -12))
Note the syntax differences between SUMIF and SUMIFS.
Another approach would be comparing the column header labels in a SUMPRODUCT function.
=sumproduct((a1:z1="amount")*a2:z999)
Do not use full column references with SUMPRODUCT. Always restrict your data ranges to the extents of your actual data.

Issues with VLOOKUP in Excel

I have a tax table in one sheet that has a list of tax values. For example:
Sheet1: Tax Tables
A B C
1 Min Max Taxed
-------------------
2 50 100 10
3 100 200 20
4 200 300 30
In another sheet I have a gross income value of say 120 in cell A1. What I want to do is have a vlookup (I'm assuming that's what I should use) that checks cell A1 to see if it's between the Min and Max and then outputs the taxed amount in B1.
Sheet2: Income
A B
1 Gross FedTax
-----------
2 120 Value from Column C goes here
I already have the sheet in Tax Tables set up with named spaces A:C=Min and B:C=Max
I tried doing this:
=AND(VLOOKUP(<A1,Min,3,False),VLOOKUP(>A1,Max,2,FALSE))
But not even close...
I just want to check column A in the first sheet to see if it's less than the the value in the second sheet, and check column B in the first sheet against the value in the second for if its more, then put the value in column C in the first sheet into the cell next to the value in the second sheet.
To use a VLOOKUP, put your maximums and minimums in the same column.
Then use the TRUE argument, which means it looks for the next value that matches. Assuming the value you're looking up in D2, you'd put a formula like this in E2:
=VLOOKUP(D2,$A$2:$B$5,2,TRUE)
First of all it is unclear what you would apply when the amount is exactly 50/100/200/300/... So i decided to include the lower limit in the interval and exclude the upper limit.
For this problem I would use a sumifs like this (you have to decide on which side to put the equal sign:
=SUMIFS(Sheet1!C:C;Sheet1!A:A;"<="&A1;Sheet1!B:B;">"&A1)
This would only take those elements in column C that have a value in column A smaller than or equal to 120 and a value in column B greater than 120

Resources