How can I do this equation in excel
If text "t" then goto cell x if not goto cell y
And perform function
I.e
If cell has letter t do (28.5%*cell) if not do (15%*cell)
So the way i understand, You have 3 columns, 1 with a letter, and 2 with numbers. column 1 is either t or something else, and then column 2 and 3 are various answers. So my solution assumes that the letter is column a, and the numbers are columns b and c, and the function goes in d. you can adjust accordingly if the columns are different. then you can drag the function down (or up if you place it in a cell thats on at the top) and it will adjust the row numbers.
=IF(A1 = "t",B1 * 0.285,C1 * 0.15)
so basically it takes cell A1 and checks if it is the letter t. if so, it takes the number in b1` and multiplies it by 28.5% and if not, it takes the number in c1 and multiplies it by 15%.
If text "t" then goto cell x if not goto cell y
Assuming you meant "resolve to" by goto, this could be what you are looking for:
=IF(S1="t",X1,Y1)
When the value of cell S1 is "t", the value of the cell the formula is in, would be the value of cell X1, Y1 otherwise.
If cell has letter t do (28.5%*cell) if not do (15%*cell)
This would be the formula:
=IF(IFERROR(SEARCH("*t*",A1)), 28.5% * B1, 15% * C1)
Some test-data:
A | B | C
1 mytest | 100 | 200
EDIT a ',' was missed there.. I popped that into Excel and it didn't work.
should be =IF(IFERROR(SEARCH("*t*",A1),), 28.5% * B1, 15% * C1)
and that works
Related
I have 2 columns x and y
x Y
0 1
1.645 7.897
3.444 6.4387
2.345 5.9090
3.890 5.4322
4.789 3.4321
5.666 4.1111
keeping x at a constant value ( say i pick 3.890) i want to find all increments of +1's of the corresponding Y column . In the above example I want (5.4322 + 1 + 1 + 1 ) upto a certain range.In the above example i want the values (6.4387, 7.987) .If an exact +1 value does not exist i want the closest value to it .Is there a formula i can use to achieve this in excel ? . Any help is much appreciated.
expected output :
New column
5.4322
6.4387
7.897
Suppose you have the following named ranges:
x being values under x column;
y being values under y column;
Pick_x being the selected value from x column.
Enter the following formula in Cell G2 and drag it down to G8:
=IF(INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1)>MAX(y),"",INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1))
It will return the corresponding y value +1s based on the selected x value, but will show blank if the +1 value is outside the range set by y column.
Then enter the following array formula (confirm by pressing Ctrl+Shift+Enter in the formula bar) in Cell H2 and drag it down to H8:
{=IFERROR(INDEX(y,MATCH(MIN(ABS(y-G2)),ABS(y-G2),0)),"")}
It will return the corresponding closes match from y column based on the value in Column G, and return blank if there is no value in Column G.
I used Column G as a helper column but you can choose to replace G2 in the second formula with the first formula, but it will make the formula too long to be easily understood.
If I change the x value to 4.789, Column H will return the following:
Let me know if I've misinterpreted your question. Cheers :)
I can't seem to find anything similar that's already been asked (they all relate to incrementing row numbers rather than columns)
I'm looking to drag a formula across horizontally and have the columns increment by 2
E.g. B1-A1, D1-C1, F1-E1...
Thanks!
You'll need to have a value in cell A1 and B1 for the following to work.
For my testing I put the number 1 in A1 and B1.
Try this in Cell C1:
=IF(MOD(COUNT($A$1:B1),2)=0,COLUMN(B1),IF(B1<>A1,B1,A1))
Here's what you should see when you drag that formula across:
A B C D E F G H I J K L M N
1 1 2 2 4 4 6 6 8 8 10 10 12 12
And this is what the formula does:
The MOD(COUNT() part of the formula counts the cells to the left of it, and if they are a multiple of 2, the value changes.
I've left the value to change to (the 'new' value) as the COLUMN() number for the cell before, just for example's sake. but you can change this part.
The last IF statement at the end checks if the cell before is equal to the cell before that, (eg. Is CELL C1 equal to CELL B1) and if they are not equal, it will give the cell before as a value (the 'copy' value).
How can I search if values in one cell (column A) exist in column B. With an approximate threshhold of +/- .5
For instance:
Cell A2: 100.26
Column B: 100.30
Is there a formula that can search A2 within all of column B for an approximate match +/- .5 to return true/false?
You can use COUNTIFS() for this:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)
This tests values in Column B twice. Once to see if there is a value less then A2+.5 and then again to see if that value is also greater than A2 - .5
If you want this to return True/False, just turn it into an inequality:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)>0
Update with Example
To show this working, put value 10 in cell A2. Then in B1 though B5 put the following list:
1
4
10.2
20
24
Now in C1 (or any cell on the same tab that isn't A2 or in Column B) put the formula from above:
=COUNTIFS(B:B, "<" & A2 + 0.5,B:B, ">" & A2 - 0.5)>0
And it will spit out "True" because the value 10 that is in cell A2 is within +/-5 from a value that exists in Column B.
Add 2 helper columns C and D where C is =B1-0.5 and fill down and D is =B1+0.5 and filled down.
Then =if(and(a2>C2,a2<D2,TRUE,FALSE)
I have two input values, that I want to use to return a third value.
Input 1: Y (lets say "Y" is in cell B1)
Input 2: 15 (15 in cell B2)
In another database sheet the input 1 values are sorted in the top row, the input 2 values are listed in a column in front of the wanted values.
| | X | Y | Z |
|16| a | g | k |
|15| b | h | l |
|14| c | i | l |
Fx. X,Y,Z are in row 3 and column 2,3,4.
I want a formula that returns "h" from the two inputs, Y & 15. How is this possible?
In your example above:
=INDIRECT(B1&B2) will return the value in [Y15] which is "h"
Assuming 16 is in Row4, please try:
=INDIRECT(CHAR(CODE(B1)-22)&6-MOD(B$2,14))
Here's a formula for you:
=INDEX(MatrixRange,MATCH(RowInput,MatrixStartColumn,0),MATCH(ColumnInput,MatrixStartRow,0))
MatrixRange = whatever the range of your data matrix is (in entirety) so if your data matrix starts in A3 and ends in D20 this would be replaced with A3:D20
RowInput = whatever cell you are getting search value for to find the row of appropriate data (This is Input 2 on your example)
MatrixStartColumn = Whatever column (or range) your Matrix data index starts in (these would be the numbers in your example). If the numbers on the left side of your data example are in Column A, this would be changed to A:A or A1:A50 (or wherever the last value is). The important thing for this is to use a range from the start of the column otherwise your row count will be off. If you must use a sub-range to avoid matches outside of the matrix, be sure to add the appropriate number to the end of the Match statement. For example if you are specifying MatrixStartColumn as "A3:A44", you will need to add +2 for the first 2 rows being skipped (A1 and A2). So the Index statement becomes (MatrixRange,MATCH(RowInput,MatrixStartColumn,0)+2,...
ColumnInput = whatever cell your column search value is in (your Input 1 data)
MatrixStartRow = Same as StartColumn above but for the header index of your matrix (the XYZ letters in your example). Just as above, if you must use only the range of the matrix, be sure to add your offset numbers so you get the right column.
Assuming that your inputs are at B1 (row), and B2 (Column) here is your formula:
=INDEX(B4:D6,MATCH(B1,A4:A6,0),MATCH(B2,B3:D3,0))
Here is how the formulas work:
INDEX(area with values, row , column) returns value based on row and column you provide.
MATCH(value to find, range to search) returns row/column where value was found.
Note that Match will accept only one row or column for 'range to search'.
I need a formula for excel that will allow me to take a sum and divide it up into a number of cells.
for example:
A1= sum
B1 to B4 needs to have a portion of the devided sum
i.e. if sum 1000 then B1=100 B2=200 B3=300 B4=400
Thank's in advance guys
The decomposition rule is that it goes from B1 to B4 in intervals of 100...adding to the pervious
The formula for the lowest term is (2 * s / n - (n - 1) * d) / 2 where
s is the sum
n the number of terms
d the common difference
You have n = 4 and d = 100.
So the lowest term is (s / 2 - 300) / 2.
So if cell A1 contains the sum (1000), you can write =0.5*(A1 / 2 - 300) in cell B1
Then B2 = B1 + 100, B3 = B2 + 100 and B4 = B3 + 100.
The formula comes from the sum of an arithmetic progression.
Try this
Set alias to cell A1 as amount
Use a cell for the number of division which is 4, assume to put in cell A2
Calculate the formula for the total portions to divide, put it in cell A3. In your case A3 =A2*(A2+1)/2
Set alias to cell A3 as total
In each of B columns, set the formula as =(ROW()/total*amount)
Copy the formula from step 5 above until the maximum row in B according to your need