Find Some in Excel by omitting negative figures - excel

How do I find the sum of only positive values in a column in Excel?
For example, if a column contains 12,85,100,0,55,-45,-80,200 sum this columns by omitting negative figures would be 452.00?

Use the array formula:
=SUM(IF(A1:A100>0,A1:A100))
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.

=SUMIF(A1:A100;">=0")
That's the quickest way
Another useful way if you are working on an single column of data is to just use the name of the column instead of a range:
=SUMIF(B:B;">=0")

Related

Lookup excel return min value if no match found

If number from first coulmn is found in the second column, it should return that number.
If number from first coulmn is not found in the secound column, it should return closest possible min value
You can use vlookup() like this, BUT you need to sort the values:
In C1 enter the array formula:
=MAX(IF(B:B<=A1,B:B))
and copy downward:
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
NOTE:
Sorting is not required.
Array entry is not required if you are using Excel 365.
Another option is SUMPRODUCT:
=SUMPRODUCT(MAX(--($B$1:$B$12<=A1)*$B$1:$B$12))
It works on Excel 2007 or higher, no need of array entered formula and no need of sorting.

Find Length=2 cell in a given range

I have these two rows with an image path.
In Columns D-H i have only one cell that his length is 2.
I need to find it and do formulas based on it, and I would prefer not writing 5 times "IF", any quick way to find it?
It's unclear what you're asking but it seems like you're just trying to figure out which column has a string with a length of 2 characters.
If this is the case use this formula (assuming your data starts in row 2 of the columns you mentioned):
=match(2,len(D2:H2),0) However, when you write this hit CTRL + SHIFT + ENTER
Which will give you {=match(2,len(D2:H2),0)} this is an array formula you must carry down. This will give you the relative column of the string with 2 as its length. Relative meaning, if the criteria is met in column D, it will return 1 (instead of 4).
If you want the value, just use an Index match like so, using the same CTRL + SHIFT + ENTER I mentioned earlier.
{=index(D2:H2,match(2,len(D2:H2),0))}
Here's a non-vba, non-CTE/Array formula way to do this:
=SUMPRODUCT((LEN(D1:H1)=2)*COLUMN(D1:H1))
Will spit out the number of the column that has a length of 2. If more than one column fulfills this criteria then you will get back garbage. So don't do that.
You can pop that into Index() to get the value that was hit:
=INDEX(A1:H1, 1, SUMPRODUCT((LEN(D1:H1)=2)*COLUMN(D1:H1)))

Searching within a list of strings with anything in another list of strings in Excel

Example Data
I need to find anything in column B within the strings in Column A and output the cell in Column A in Column C.
I know if it is a short list I can do the highlight cell if a text contains x with Conditional Formatting. However, I have a long list of items that I need to check within the strings of another list.
Let me know if anymore detail needs to be provided. Any help is appreciated. Thanks.
Try this Array formula with wildcards:
=IF(ISNUMBER(MATCH(1, IF(ISNUMBER(SEARCH("*"&$B$1:$B$3&"*",A1)),1,0),0)),"Y","N")
It is an array and need to be confirmed with Ctrl-Shift-Enter.
The search area represented in this small example, $B$1:$B$3 when enlarged must be to the exact range of lookups or it will not return correct values.
You can do this with array formula, type the following in cell C1, then press Ctrl + Shift + Enter:
=INDEX(B:B,MATCH(TRUE,FIND(B:B,A1)<>"#VALUE!",0))
Drag it down column C to match number of rows in column A. You can then put a conditional formatting/filter to see what row in A has substring in B.
If you simply want a yes/no result, enter the following into D1:
=IF(COUNTIF(C1:C6,"<>0")>0,"Found","Not Found")

How can I get lists of items ignoring blank cells from a column using only excel formula (Without VBA)

Please see the image which will show my data and expected output.
Use this formula in C2 cell: It is a array formula, so press Ctrl + Shift + Enter after entering formula.
=IFERROR(INDEX($A$2:$A$15,SMALL(IF($A$2:$A$15<>"",ROW($A$2:$A$15)),ROWS($A$2:$A2))-1),"")
With the release of Excel 365 and Dynamic Arrays, this becomes very simple:
=FILTER(A:A,(ROW(A:A)>1)*(A:A<>""))
ROW(A:A)>1 is used to exclude the header,
A:A<>"" is used to exclude blanks
And if you are concerned about the order in which they appear. Create another column and insert index values from 1 to n (Fill Down - Series). Then:
-sort by fruit
-delete the numbers in index column where there is no fruit (they should be in the bottom)
-sort by index from smallest to largest.

MS Excel create virtual column to use in formula

I want to do something similar to summing 1/x from 1 to 100 without creating an extra column to help with the calculation. I want my first column to be the numbers 1 through 100. And I want a cell to show the sum of 1/x where x is each cell in the first column. Currently the only way I can think to do this is to create a second column to do 1/x for each individual cell then sum the second column. Is there any solution to doing this without having to create the second column?
Thanks!
You can use this "array formula"
=SUM(1/A1:A100)
confirmed with CTRL+SHIFT+ENTER
....or avoid array entry by using SUMPRODUCT
=SUMPRODUCT(1/A1:A100)
both versions assume you don't have zeroes (or blanks) in A1:A100
if you might have zeroes or blanks then use this array formula
=SUM(IF(A1:A100,1/A1:A100))
if you mean 1 + 1/2 + 1/3 + ... + 1/100, use following array formula (entered by Ctrl+Shift+Enter instead of just Enter):
=sum(1/row(A1:A100))
You need to use an array formula as below:
{=SUM(1/A1:A100)}
where A1:A100 contains 1 to 100
You create the array formula bu typing the formula as =SUM(1/A1:A100) and then pressing Control-Shift-Enter.
If you do it correctly the formula then shows up with the curly brackets {} but you don't enter the curly brackets yourself.

Resources