How to change the value of a cell wiout changing the range? - excel

I have the following columns and data:
column1
1(cell A1)
2(A2)
3(A3)
Say I want to do like transpose(A1:A3) but want to change the value of 2 in A2 to 0, "inside the transpose formula". Is this possible??? Thank you very much.

{ =TRANSPOSE(A1:A3*(ROW(A1:A3)<>2)) }
Some explanation:
We are transposing an array, not directly A1:A3 but the result of one-by-one multiplication of A1:A3 and (ROW(A1:A3)<>2)). This results in the column vector:
A1 * 1 A1
A2 * 0 = 0
A3 * 1 A3
Which is what you want to transpose.

Related

How to convert this condition to an excel function ..?

Please, I need to write this condition in excel as a function :
if( A1 = 2 AND A2= 3 ) then { A3 will equal 10}
else if( A1 = 4 AND A2= 5 ) then { A3 will equal 20}
else if ( A1 = 6 AND A2= 7 ) then { A3 will equal 30}
A1, A2, A3 are the excel cells
thanks a lot in advance
Using some boolean logic:
=((a1=2)*(a2=3)*10)+((a1=4)*(a2=5)*20)+((a1=6)*(a2=7)*30)
Put the formula in A3:
=IF(AND(A1=2,A2=3),10,IF(AND(A1=4,A2=5),20,IF(AND(A1=6,A2=7,30,"NOT ANY OF THE CHOICES")))
As a literal interpretation, this formula matches what you're looking for:
=IF(AND(A1=2,A2=3),10,IF(AND(A1=4,A2=5),20,IF(AND(A1=6,A2=7),30,"invalid values")))
However, using a lookup table might be better, like so:
The lookup table is in columns E:G, and then the formula in cell A3 is (adjust the table ranges as necessary to account for all value combinations):
=INDEX($G$2:$G$4,MATCH(A1&A2,INDEX($E$2:$E$4&$F$2:$F$4,),0))

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

Logical calculation in Excel

I need advice/help. I am working on calculation in excel where I have data like mentioned below.
. A B C D E F G H
1| A275 A277 A273 A777 A777 TOTAL A222 GRAND TOTAL
2| 5 7 4 3 4 7 7
Now, I want to count row 2 based on the header.
Here is the condition.
If A1 <> B1 then take A1, if B1 <> C1 then take B1, if C1 <> D1 then C1, so on.
But tricky part is...
If D1<>E1 then D1 else (if E1<>F1 then E1 else (if F1 = "TOTAL" then F1 else(if F1<>G1 then F1)))
In short H2 should have 30 and not 37.
Added comments:------------------------------------
So, Basically if A1<>B1 then take A1 but if A1=B1 then take B1, but then for B1, its a same rule like if B1<>C1 then take B1, but if B1=C1 then take C1 and for C1, same rule. Stopping point will be "TOTAL". Along with these logic I need to check if any cell in row 1 is "TOTAL" then take value for same column. Now this "TOTAL" can be in any cell in row 1.
So from above table my calculation will be 5(A2) + 7(B2) + 4(C2) + 7(F2) + 7(G2) = 30
In this calculation I have not included D2 and E2 as D2=E2 so I took D2, here E2<>F2 so I should have taken E2, but as F2="TOTAL" so I took F2 and not D2 and E2.
I hope this make sense. (Sorry, I know its confusing.)
I have data in more then 100 columns.
Can this be achieved using Macro?
------------------------------------------------------------
Another pain point is data and header are dynamic, so I can't have a fix format. Logic should be in a way that can handle the dynamic data and header.
Any help or suggestion will be greatly appreciated.
I achieved the results you want with this.
Add a helper row. In cell A3 write this formula and drag it to the right:
=IF(OR(A$1=B$1,B$1="TOTAL"),0,1)
Calculate sum in say cell H4 (not H2 because if the formula refers to entire row 2 there will be circular reference):
=SUMIF($3:$3,1,$2:$2)

Excel Formula- Divide a sum into multiple cells?

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

Excel function for multiple formula

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

Resources