Use the text value in the Excel formula - excel-formula

I apologize for typing in English. This is a translator's achievement.
I want to come up with this formula but I can't.
A1 cell value is variable and can be one of these signs (=, <=,> =, <,>).
A3 and A4 cells also have numerical values.
Now the formula I am looking for in cell A2.
= if (A3 & A1 & A4,1,0)
So logical text can be one of the following:
A3 = A4 , A3 < A4 , A3 > A4 , A3 >= A4 , A3 <= A4
Is there a way for this formula?

To do it with formula one must do all the combinations:
=IF(CHOOSE(MATCH(A1,{"=","<=",">=","<",">"},0),A3=A4, A3<=A4,A3>=A4, A3<A4,A3>A4),1,0)

We need an extra step. In A2 enter:
="=if(A3" & A1 & "A4 ,1,0)"
Example:
Sadly A2 is only a string and not a formula, but we can execute it. In a standard module, enter the following User Defined Function:
Function eval(s As String) As Variant
Application.Volatile
eval = Evaluate(s)
End Function
Pick another cell, say B2 and enter:
=eval(A2)
Whenever A1 or A3 or A4 are changed, the string-formula in A2 will change and the value in B2 will be re-calculated.

Related

Excel - Condition of my IF Statement not returning the correct result

Can someone understand why my IF Statement isn't returning the desired result? The logic makes sense to me but obviously it is incorrect.
What I'm trying to do is make A1 = B1 if both C1 and D1 are blank. This condition of my IF Statement isn't working, it returns a 0. Does anyone know why?
What I think the logic of my IF Statement is AND what I'm trying to achieve:
IF D1 is blank, make the content of A1 = C1. IF C1 is blank, make the content of A1 = B1. Otherwise make A1 = D1.
=IF(ISBLANK(D1),C1,IF(ISBLANK(C1),B1,D1))
So check C1 & D1 and set A1 = B1, enter this in cell A1:
=if(and(C1="",D1=""),B1,D1)
This will set cell A1 equal to B1 if C1 & D1 are blank, if either C1 or D1 are not blank then A1 will be equal to D1.
This is based on your middle paragraph:
What I'm trying to do is make A1 = B1 if both C1 and D1 are blank.
What you have in your final paragraph is different:
IF D1 is blank, make the content of A1 = C1. IF C1 is blank, make the content of A1 = B1. Otherwise make A1 = D1.
As you don't test C1 and D1 together.
Edit based on your comment:
=IF(AND(ISBLANK(C1),ISBLANK(D1)),B1,if(isblank(D1),C1,D1))
Which does if both C1&D1 are blank then B1, if D1 is blank then C1 if not B1.

How can I change the formula of the cell according to the value of another cell

If Cell A1 = X, Cell B2 = sum(A1+A2)
If Cell A1 = Y, Cell B2 = sum(A1+A3)
is excel capable of doing this? if not using VBA
let A1 have a value of 5
let D2 have a value of 5(Where this would represent your Y.
then B1 have a value of =if(A1=D2,SUM(A1:A3),SUM(A1:A2))
Try this in B2,
=sum(A1, if(a1="X", A2, if(a1="Y", A3, "")))
Of course you cannot get any numerical value from X or Y so using A1 as part of the sum is pretty useless but you can modify for you own purposes.

Concatenate and fill but not continuously

I have an excel sheet that I need to concatenate a couple of cells and then add a number. I want something like:
A1
A2
A3
A4
B1
B2
B3
A5
But instead, I get:
A1
A2
A3
A4
B5
B6
B7
A8
Is there a way to achieve what I want?
Thank you
Does this work for you? Added a helper column.

excel fill series restart from 1 after new value

I have the following in one column, it keeps going down with random letters but always end with 1.
a1
a1
b1
b1
b1
b1
b1
c1
c1
c1
how can i make it fill series but start again from one when ever a new letter.
It should look like this:
a1
a2
b1
b2
b3
b4
b5
c1
c2
c3
You can genereate a new series in the column beside it. Lets assume your data starts in A1. In put 1 in B1 and in B2 place the following:
=IF(left(A1,len(A1)-1)=left(A2,len(A2)-1),B1+1,1)
Copy B2 down.
When you are done, you can copy your information from column B and paste is a values if you do not want the numbers changing again.

Cell address defined by the contents of other cells

How do you define variable cell address in Excel. For example consider the case where the content of cell A1 is 5, cell A2 is 2, cell A3 is 10 and cell A4 is 1. How do I enter a general formula to SUM the content of the cells A7 (A1+A2) through A9 (A3-A4)? I would then like to drag the formula to columns B through CJ,... and repeat similar calculations noting that values of B1 through CJ4 are different than A1 through A4. I appreciate any suggestions.
=SUM(INDEX(A:A,A1+A2,1):INDEX(A:A,A3-A4))

Resources