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

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.

Related

Formula to sum up formatted cells with commas

I'd like to sum up all the formatted D2:D6 cells and print this info in total
---------------------------
D2 | January | 1,000 |
---------------------------
D3 | February | 2,000 |
---------------------------
D4 | March | 3,000 |
---------------------------
D5 | April | 400 |
---------------------------
D6 | May | 500 |
---------------------------
D7 | Total | 6,900 |
---------------------------
I tried to apply this formula, but it gave me an error:
=SUM(VALUE(REPLACE(D2:D6;FIND(",",D2:D6;1),1;"")))
Just sum the range.
If the range is not numbers, but text that looks like numbers, the question is: why is that so? Why would a number be turned into text?
To insert a thousand comma?? That can be done with number formatting without destroying the number data type.
the data was downloaded like that from a report? Use Power Query to load the report and clean up the data in Power Query. Then you can use simple Excel formulas.
If none of the above are viable options, the final resort can be a formula, like
=SUMPRODUCT((SUBSTITUTE(D2:D6,",","")+0))
Your sample formula suggests that your regional settings use the semicolon to separate parameters in Excel, so you need this:
=SUMPRODUCT((SUBSTITUTE(D2:D6;",";"")+0))
Edit: Another variant that will not break if a cell in the range is blank or contains text that cannot be converted to a number:
=SUMProduct(IF(ISNUMBER(SUBSTITUTE(D2:D6,",","")+0),SUBSTITUTE(D2:D6,",","")+0,0))
the semicolon version:
=SUMProduct(IF(ISNUMBER(SUBSTITUTE(D2:D6;",";"")+0);SUBSTITUTE(D2:D6;",";"")+0;0))
With this construct you can also use Sum() instead of SumProduct() but note that for non 365 versions of Excel the Sum() variant the formula needs to be confirmed with Ctrl+Shift+Enter.
Cleaning the data up with Power Query might be a lot easier than using formulas like that for simple calculations like totaling numbers.

Vlookup a value and then compare dates

I am wanting to look up a value from a table, than take a date and compare it to the row and find which date corresponds to the date I enter.
| Column1 | Effective 1 | Effective 2 | Effective 3 |
|---------|-------------|-------------|-------------|
| abc | 1/1/2016 | 1/1/2017 | 1/1/2018 |
| cba | 1/2/2016 | 1/2/2017 | 1/2/2018 |
I want to look up colum1 and find for example cba; then want to link a date to which effective date, which is always the date less than. So, if the date I am looking up is for cba and it is 6/7/2017 it would correspond to effective 2 which is 1/2/17.
I have tried index match match and also vlookups with embedded if statements and neither of them work.
Using structured references (in a Table), the following formula will do what you want.
=LOOKUP(2,1/((INDEX(myTable,MATCH(F2,myTable[Column1],0),0))< TODAY()),INDEX(myTable,MATCH(F2,myTable[Column1],0),0))
The formula uses documented but somewhat obscure features of the INDEX and LOOKUP formulas. See MSDN Help for more details:
MATCH ► find the row that matches the search term in F2 to use as row argument in INDEX
INDEX with a column argument of 0 ► return the entire row
< TODAY() to do the less than comparison. You can use a cell reference instead of you need to.
1/(... will return 1 or DIV/0 errors depending on the comparison
LOOKUP where the lookup_value is greater than anything in the array will match the last numeric value in lookup_array and return the value in the same position in results_array

Excel formula to sum values based on reference number in another column

I have two columns. One is an amount and the other is a reference number. I need a formula to sum all amounts per reference number next to the reference number in order to sort from highest to lowest value per reference.
Amount | Reference | Sum per Reference
122.00 | 405221 | 316
194.00 | 405221 | 316
339.80 | 405682 | 851.25
296.45 | 405682 | 851.25
215.00 | 405682 | 851.25
The closest formula I found on this website, was:
=IF((AR2=AR3),"",SUM($AQ2:AQ2-SUM(AV$1:AV1)))
This however only puts the sum value (like a subtotal) at the last reference number and leaves the other ones blank. I need it to put the sum value for each reference number next to all the lines and have not blank spaces?
It sounds like what you're looking for is the SUMIF function. It sums values by a criterion, so in this case we can use it to sum all values that match another value. Assuming your values are in Column A and your criteria are in Column B:
=SUMIF($B:$B,$B2,$A:$A) Put this formula in your "SUM per Reference" column and copy it down, and you should get a good result.

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

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.

Excel VLookup #NV error

I'm trying to make a VLookup in Excel but I get everytime a #NV error.
This is table EVENTS:
This is table TRACK:
the formula on field F2 in table EVENTS is
=SVERWEIS(E2;TRACKS!$A$2:$B$52;1;FALSCH)
SVERWEIS is the word for VLOOKUP in the German version. FALSCH means wrong
As has been mentioned, VLOOKUP (SVERWEIS) can only look to its right to find a value to correspond with a value in the left hand columns of a table. The INDEX/MATCH combination is more flexible in this respect so if not to rearrange your columns I would suggest something like:
=INDEX(A:A,MATCH(E2,B:B,0))
where TRACK is assumed to be in ColumnsA:B. Converting to German, perhaps:
=INDEX(TRACKS!A:A;VERGLEICH(E2;TRACKS!B:B;0))
VLOOKUP compares the values in the first column of your reference target, you have your target values in the second.
Just swap VLOOKUP and the TEXT columns on your TRACKS sheet and it will work just fine.
Try switching the columns in TRACKS around.
VLOOKUP bases it's lookup on the first column, so in your case, it's looking through column A (1, 2, 3, etc.)
If you want your VLOOKUP to be based on the text, it needs to be in A instead.
i.e.
| A | B |
----------------------
1 | TEXT | VLOOKUP |
2 | Text1 | 1 |
3 | Text2 | 2 |
etc...
Then your function will be:
=SVERWEIS(E2;TRACKS!$A$2:$B$52;2;FALSCH)
Switching out the third argument because you now want the value from the second column

Resources