I have the following columns:
A - Original values, B - Absolute values, C - sorted absolute values
(I obtain the ordered values (C) using the SMALL formula for the given range - see the link bellow)
I need to know for each ordered absolute value, if the original value was or not negative:
So in the picture the red columns I filled-in manually...
Is there a way to automatize that via a formula ?
Here is the link to the sandbox in Excel Online: http://1drv.ms/1Vu2MZ4
If the first link does not work, the same thing and formulas on Google Sheets
A partial answer, which might be enough if column E in your screenshot is what you want and column D was a helper column intended to make column E easy to compute.
The problem with ABS() is that it loses information. Instead of using that, use a function which doesn't lose information but also doesn't change the sort order and which makes it possible to recover the absolute value after sorting. One way is to leave positive numbers alone but send negative numbers to their absolute value + 0.5. For example,
In B2 enter
=IF(A2 >= 0,A2, 0.5+ABS(A2))
In C2 enter
=SMALL($B$2:$B$6,-1+ROW())
In D2 enter
=INT(C2)
To recover the absolute values. Finally, in E2 enter
=IF(C2=D2,FALSE,TRUE)
(copying all of the formulas down).
In your case and for your locale =MATCH(C2; $B$2:$B$6; 0) and = INDEX($A$2:$A$6; MATCH(C2; $B$2:$B$6; 0)) < 0 will do but beware of cases where you have the same value both negative and positive.
Related
I have a huge amount of data to process in which 4 points with a related prefix needs to be subtracted from each other.
Data consists of ID and x value
Example
ID = 290.12, 290.03, 290.06, 290.09, 300.12, 300.03, 300.06, 300.09, 301.12, 301.03, 301.06, 301.09
(let's call prefix a "ring number" and suffix time on the clock)
X value = any numerical value for each ID assigned
What I'm hoping to do is to search for the first number before the dot i.e. 300 and then subtract the value of 300.06-300.12 in one cell and in another cell 300.03-300.09.
(The subtraction is just an example, how I need to manipulate with the numbers is slightly more complicated, but I got this one under control)
This is my actual Data and what I need to produce is to the right of the raw data. At the moment, I'm doing it manually for each set of "rings"
Anyone knows how to approach this? I'm thinking vlookup, but I'm not very proficient in excel.
New Excel
I tried vlookup, but I don't know how to construct the formula and I run out of ideas.
Edit:
I found out that REDUCE is no requirement in this case, so it can be shortened to:
=SQRT(SUM(((INDEX(B:D,XMATCH(I3+0.09,A:A),SEQUENCE(1,3))-INDEX(B:D,XMATCH(I3+0.03,A:A),SEQUENCE(1,3)))^2)))
You could change +0.09 and +0.03 to your needs and may reference them using LET() for easy maintaining:
=LET(id,I3,
_id1,0.09,
_id2,0.03,
SQRT(SUM(((INDEX(B:D,XMATCH(id+_id1,A:A),SEQUENCE(1,3))-INDEX(B:D,XMATCH(id+_id2,A:A),SEQUENCE(1,3)))^2))))
Previous answer:
=LET(
id,I3,
_id1,0.09,
_id2,0.03,
SQRT(
REDUCE(0, SEQUENCE(1,3),
LAMBDA(x, y,
x+((INDEX(B:D,XMATCH(id+_id1,A:A),y)
-INDEX(B:D,XMATCH(id+_id2,A:A),y))
^2)))))
This formula looks for the matching value of the id value I3 + _id1 minus the matching value of id value + _id2 for columns B to D and adds the ^2 results per column. Then it calculates it's square root.
You can change _id1 and _id2 to your needs.
To calculate the Delta (as shown) at once you could use:
=LET(id,I3,
_id1,0.09,
_id2,0.03,
_id3,0.12,
_id4,0.06,
x,SQRT(SUM((INDEX(B:D,XMATCH(id+_id1,A:A),SEQUENCE(1,3))-INDEX(B:D,XMATCH(id+_id2,A:A),SEQUENCE(1,3)))^2)),
y,SQRT(SUM((INDEX(B:D,XMATCH(id+_id3,A:A),SEQUENCE(1,3))-INDEX(B:D,XMATCH(id+_id4,A:A),SEQUENCE(1,3)))^2)),
(x-y)*1000)
You can have a column of unique values of the integers and a new column where you reference these values as id and drag down the formula to get your row by row result
In another column you can refer to these columns and sort per the second column using SORTBY()
So i try return value from table which has same percentage using Index match, but it return the same value twice instead of another value that has the same percentage
Here is my Excel View, is there any help for my problem?
Here is my excel formula
enter image description here
1st: you can't and shouldn't use Match(...,...,-1) in unsorted data, use Match(...,...,0) only
2nd: you can't search for the 2nd similar because... the program has no way of knowing there are 2|3... similar objects. So you must get the positions of ranks when sorting them, and then use that position to get the score and value you want with index(). So Sorting and getting the Position (or ROW()) must be done same time.
3rd: the way to do this is with Matrix formulas that work for on a pre-specified number of cells: So you can look in a table of 200 elements for 10 results and have provision to avoid errors if results are <10, but you'll never get 11. Also Hide the column with the positions to gain clarity...
try this formula:
= LARGE( ROUND( OFFSET($B$3,,,$G$1)*1000,0)*100 + ROW(OFFSET($A$1,,,$G$1)),ROW(OFFSET($A$1,,,$G$2)) )
to get a sorted list from column B Starting w B3 with N rows (N specified in G1) and look for m results (m specified in g2). Offcourse adjust the bolds as needed for your project
4th: Enter the formula in a Column that you will hide, with ctrl+shft+Enter (to enter as matrix) and expand it in as many cells as the results you expect (in the example 2) by selecting them starting with the cell with Array-formula, then F2 (to edit formula) and ctrl+sht+enter. Mind that Arrays can only be EXPANDED, if you want to shrink it you have to delete it and rebuild it...
5th: get the Index with =MOD( ... ,100) ,where ... are the results from steps 3&4
1ST AGAIN: Another simple solution (*not to my Liking). Within your Match(item,range,-1) you should compare item with previous item and use Offset. In your formula you can write:
=Index($C$12:$C$23, Match(DF19, Offset( $CQ$12:$CQ$23 ,if(DF19=DF18, Match(DF19,$CQ$12:$CQ$23,0),0) ,-1) ))
thus pushing the search matrix further down to avoid finding the same.
(added code with BOLD, rest should be same to your original code)
I need a formula to assign tasks into general categories using a table of values. The purpose is so I can calculate how much a client would have spent last year using new per-task pricing (by category) instead of hourly rates (by task). The formula is super close, but it's returning first matches instead of exact matches to the entire cell contents. Several task types share text, so this is problematic.
I've tried messing with the EXACT function and using delimiters, but I'm not making real progress.
The formula I'm using now is:
=INDEX(" "&category&" ",MATCH(TRUE,ISNUMBER(SEARCH(" "&task&" "," "&D2&" ")),0))
What I'm looking for, for example, is to have the correct category populate out of Column P based on an exact, entire cell match between Column N and Column E.
In other words, when E exactly and entirely matches a value in N, return the corresponding value from P (located in the same row as N value).
sample data
I am not sure if I understood exactly what you want, but I think you can use, at E2:
=IF(COUNTIF(N:N,D2)>0;VLOOKUP(D2($N$2:$P$40,3,FALSE);0)
The formula is checking if the value at D2, mathces with some value at column N. If yes, it will return the correspondente alt column P. If not, will return 0
At first thanks to answer)) (It's important for me :p )
I have a number in A3.
When there is this number in column A (Sheet1), per exemple A7 then it will take the value of the cell B7.
=SOMMEPROD(('Sheet1'!A3:A34=Sheet1!A3)*('Sheet1'!B3:B34))
I use SOMMEPROD, it's working but only with number, and sometimes I have text and number in my cell (column B).
I already changed the format of the cell but doesn't work.
Thanks a lot)))
I think you are saying that some of the values in column B are expressed as text, not as a number, probably because they were imported from another source.
if that is the case: First, convert column B into numbers, Then, use sumproduct.
For example, FIRST convert text to values:
in C3 you would enter
=value(b3)
Then copy that down to from C3 to C34.
Then
=SOMMEPROD(('Sheet1'!A3:A34=Sheet1!A3)*('Sheet1'!C3:C34))
should have the desired effect.
Note that you sometime get #N/A errors with the "value" function, for example if there are unexpected spaces. To be safe, rather than using value alone, try this:
= iferror(value(B3),0)
or to be more creative you can try:
= iferror(value(substitute(B3," ","")),0) ' deletes all spaces
= iferror(value(substitute(substitute(b3,char(160),"")," ","")),0)
'deletes all spaces and "nonbreaking spaces" copied from a web page
It depends on what you're trying to use SumProduct for. There's two main reasons this function shows up. Those are:
To sum the product of two ranges.
To sum a range of numbers that meet multiple criteria. This relies on that True = 1 and False = 0 so when want to find the combined weight of blue dogs in some cells, your formula might look like =SUMPRODUCT(1*($A$1:$A$50 = "Blue"), 1*($B$1:$B$50 = "Dog"), $C$1:$C$50). Note the 1* which guarantees the formula will know how to multiply the results. After all, True and False don't multiply. Their binary representations (1 and 0) though, do.
NB though that people also sometimes remember it as a lookup formula because of the second use, and therefore expect to be able to get text back. Such approaches are an easy misunderstanding to end up with, but really there you want to use an INDEX(<Result Array>,MATCH(1,INDEX(1 * (FIRST CONDITION) * (SECOND CONDITION) * (AND SO ON),,),0). This approach basically gives you an array formula without CTRL-SHIFT-ENTER (it's not faster, but because the condition is in an index formula, it works), and your conditions can be arbitrary (the same way as for sumproduct). But it'll give you the FIRST result, not the sum of all of them.
Hope that helps.
Edit: Crossed my mind, you might be expecting A1 to contain Erp and B1 to contain 54, and in C1 you want Erp54. This doesn't even need a function - just the & operator, which joins two strings together - so in C1, you'd just put =A1 & B1. And you're done.
Hi All,
I have a table for employee scores levels (Table D1 to F6), there is points for each level, for example score (4.60) will be in the 3rd level which has (3) points.
I want to write a formula in the column (B) to check in the table an return the point value from the column F, You can see the examples in D2 & D3.
Regards
Adel
What you need is one of the most awesome functions ever invented... VLOOKUP
=VLOOKUP(A2,$D$2:$F$6,3, TRUE)
(Paste in B2 and drag down)
Quick explanation of the arguments.
A2 is the value we're going to be looking up in the table
$D$2:$F$6 is the "table" we're going to be looking up. It's going to search the first column of it (You could have anything you wanted in Column D, VLOOKUP Only looks at the first column).
3 is the column number of our table that contains the answers we want to be looking up, and returning (in this case, F).
TRUE means we want to search ranges, not just exact values. If it was FALSE then we'd only get the numbers we wanted if we entered the precise scores.
Of course, using this method, there isn't any upper bounds to it, a value of say 20 would give us the last row (i.e. 5 points), however, you could fix this easily using an IF statement.
=IF(A2 > $E$6, "N/A", VLOOKUP(A2,$D$2:$F$6,3, TRUE))
This could of course be done a bit neater if you believed you were going to be adding more rows to the table later, but it works for now.
Use the Below formula in cell B2:
=VLOOKUP(A2,$D$2:$F$6,3, TRUE)