i want to split the value of the excel cell in two values, but still have them only in one cell. I mean: i have cells with for example 40/50. Many of them. I want to count sum of numbers in front of / and the second sum of numbers behind /. Is it somehow possible without splitting those numbers in two different columns?
thx
If all your cells in range A1:A4 are in format x/y,
to sum all x use: =SUM(1*LEFT(A1:A4,FIND("/",A1:A4)-1))
to sum all y use: =SUM(1*RIGHT(A1:A4,LEN(A1:A4)-FIND("/",A1:A4)))
both formulas are array formulas, so you should press CTRL+SHIFT+ENTER to evaluate them.
Related
I need a formula to perform below operation in MS excel. Here is the scenario:
My case is I have to compare 4 cells in a single row. 3 of the cell values are similar and 1 will be unique always. They can be in random sequence but there will be an unique value and 3 duplicate values while comparing 4 cells. As you can see in the result column, I need the output which is the unique value. Please help me to write the formula.
If your cells contain only numbers, here's an approach using SUMIF and MODE.SINGL
=SUMIF(A2:D2,"<>"&MODE.SNGL(A2:D2))
For text or numbers, you can use an array formula - enter with Ctrl + Shift + Enter.
=INDEX(A2:D2,MATCH(MIN(COUNTIF(A2:D2,A2:D2)),COUNTIF(A2:D2,A2:D2),0))
I'm new to excel and I am struggling to do something very easy. I have a column of unsorted numbers. I want to set all of the numbers above the last two zeros in consecutive rows in the column to zero (and also in another column set all of the numbers below the first two consecutive zeros to zero).
For example, I have highlighted all of the cells in column A that are above the last two consecutive zeros. I want a method (VBA or formula) that will set these cells to zero and create the output in seen in column B.
Would anyone be able to help?
There are various ways of doing it but I would be inclined to use a helper cell (say D1) to work out the last row where that row and the next row contain a pair of zeroes:-
=MAX(IF((A1:A19+A2:A20)=0,ROW(A1:A19)))
(this is an array formula and must be entered with CtrlShiftEnter)
Then enter the following formula in B1:
=IF(ROW()<$D$1,0,A1)
If you had negative numbers as well as positive, this would be better in D1:-
=MAX(IF((A1:A19=0)*(A2:A20=0),ROW(A1:A19)))
I have 3 columns of data which may or may not have values in them, and I want their sum.
Basically I want to make the following formula work:
SUMIF(D3&P3&AB3,"<>")
Setting the range as D3:AB3 will not work, as I have various other values in between and I only want the D, P, and AB columns summed.
I know I could use nested IFs but this is just a sample and I actually have a lot more columns to sum up.
For example D3 would have a number value, P3 would be blank and AB3 would be blank. In that case I just want to see D3 in my cell
EDIT
It works with =SUM(D3,P3,AB3), but not by =D3+P3+AB3 and I'd like to understand why
You can simply use:
=SUM(D3,P3,AB3)
SUM function will add numbers in the cells ignoring text and blanks.
I'm trying to find a formula that results in the following:
sum(max(a,b),max(c,d),....)
I tried using =SUM(MAX(0,($D$1:$P$1)-$P$3) as an array formula, but this results in excel taking the maximum of all the entries, instead I want the sum of all maximums.
You want to sum a range, say A1:H1 if it's greater than a cell, say H3. But you don't want to sum the total, you want to sum the differences between the cells in the range that meet the criteria and the cell they are being compared to, right?
=SUMIF(A1:H1,">"&H3)-(COUNTIF(A1:H1,">"&H3)*H3)
It doesn't need to be entered with ctrl shft entr as sumif is already an array formula. Adapt to your conditions as needed.
=SUMPRODUCT((D1:P1-P3>0)*(D1:P1-P3))
The first set of parens returns a bunch of Trues and Falses. When multiplied, Trues are like 1's and Falses are like 0's. So when something is below zero, it gets multiplied by zero and becomes zero.
I have an excel sheet.
Under column E, I have 425 cells with data. I want to check if the same data (i.e. text inside the cell) is repeated anywhere else in any of the remaining 424 cells under column E. How do I do this?
For example, in E54 I have
Hello Jack
How would I check this value to see if it was in any other of these cells?
You could use
=SUMPRODUCT(1/COUNTIF(E1:E425,E1:E425))
to count the number of unique cells in E1:425
An answer of 425 means all the values are unique.
An answer of 421 means 4 values are duplicates of other value(s)
Use Conditional Formatting on all the cells that will highlight based on this formula:
COUNTIF(E:E,E1) <> 1
This is based on the column being E, and starting on E1, modify otherwise.
In Excel 2010 it's even easier, just go into Conditional Formatting and choose
Format only unique or duplicate values
If you have to compensate for blank cells, take the formula supplied above by #brettdj and,
Adjust the numerator of your count unique to check for non-blanks.
Add a zero-length string to the COUNTIFS's criteria arguement.
=SUMPRODUCT((E1:E425<>"")/COUNTIF(E1:E425,E1:E425&""))
Checking for non-blank cells in the numerator means that any blank cell will return a zero. Any fraction with a zero in its numerator will be zero no matter what the denominator is. The empty string appended to the criteria portion of the COUNTIF is sufficient to avoid #DIV/0! errors.
More information at Count Unique with SUMPRODUCT() Breakdown.
This formula outputs "unique" or "duplicates" depending if the column values are all unique or not:
{=IF(
SUM(IF(ISBLANK(E1:E425),0,ROW(E1:E425)))
=
SUM(IF(ISBLANK(E1:E425),0,MATCH(E1:E425,E1:E425,0)))
,"unique","duplicates")}
This is an array formula. You don't type the enclosing {} explicitly. Instead you enter the formula without {} and then press cmd-enter (or something else if not a Mac - go look it up!) If you want to split your formula over multiples lines for readability, use cmd-ctrl-return on a Mac.
The formula works by comparing two SUM() results. If they are equal, all the nonblank entries (numeric or text) are unique. If they are not equal there are some duplicates. The formula does not tell you where the duplicates are.
The first sum is what you get by adding up the row numbers of every non-blank entry.
The second sum does a lookup of each nonblank entry using MATCH(). If all entries are unique, MATCH() finds each entry at its own position, and the result is the same as the first sum. But if there are duplicate entries then a later duplicate will match an earlier duplicate and the later duplicate will contribute a different value to the sum, and the sums won't match.
You might have to adjust this formula:
if you want cells containing "" to count as blank, then use LEN(...)=0 for ISBLANK(...). I suppose you could put other tests in there if you wanted, but I have not tried that.
if you want to test an array not starting at row 1, then you should subtract a constant from ROW(...).
if you have a huge column of cells, you might get integer overflow when computing this sum. I don't have a solution to that.
It's a shame that Excel does not have an ISUNIQUE() function!
This may be a simpler solution. Assume column A contains data in question. Sort on that column. Then, starting in B2 (or first non-blank cell, use the following formula:
=IF(A2=A1,1,0).
Than sum on that column. When sum = 0, all values are unique.
highlight E and on the home tab select conditional formatting > Highlight Cell Rules > Duplicate Values...
It will then highlight everything that is repeated.