my requirement as follows:
if a5 = 'a' then b5 = 1
if a5 = 'b' then b5 = 2
if a5 = 'c' then b5 = 3
if a5 = 'd' then b5 = 4
if a5 = 'e' then b5 = 5
else enter correct letter
total no. of conditions are more than 5 as of now and then i need to put default msg for this like 'ENTER CORRECT LETTER '
Excel's IF statement is IF(condition, trueValue, FalseValue). You can nest them to accomplish if-else chains via IF(condition1, trueValue, IF(elseCondition, elseTrue, defaultValue))
Formulas are entered in a cell in Excel by starting the cell's contents with an equals sign.
Conditions of equality in Excel use single equals comparison, not double equals.
There are other ways to approach the problem; if you had a range defined of valid entries, for example, MATCH would be useful for finding the position of a matching cell within that range.
=IF(A5="a",1,
IF(A5="b",2,
IF(A5="c",3,
IF(A5="d",4,
IF(A5="e",5,"Enter Correct Letter")))))
Insert this into cell B5
=IF(OR(CODE(A5)<97,CODE(A5)>101),"ENTER CORRECT LETTER",CODE(A5)-96)
you can see example implimentation in this sheet. Let me know if it helps or you need further explanation.
=IF(ISERROR(FIND(A5,"ABCDE")),"Enter correct letter",CODE(A5)-64)
This will work with as many letters as you want.
Related
The follow Formula give me the correct Value:
=SUM(SUMIFS('POS Data'!$G:$G,'POS Data'!$B:$B,{"5","10","11"}))
However I require part of the criteria to be taken from a cell value. eg
=SUM(SUMIFS('POS Data'!$G:$G,'POS Data'!$B:$B,E1))
E1 cell value = {"5","10","11"}
However the formula gives a 0 value. What am I missing? Why is it not recognizing that E1 is that value?
The solution used was as follows:
=SUMPRODUCT(SUMIFS('POS Data'!$G:$G,'POS Data'!$B:$B,E1:G1))
E1 = 5
F1 = 10
G1 = 11
That you #scottCraner
Assuming your import cell with your array is in E1, You have to change it from {"5","10","11"} to 5,10,11 in the cell value
=SUM(SUMIFS(G:G,B:B,TRANSPOSE(FILTERXML("<x><y>"&SUBSTITUTE(E1,",","</y><y>")&"</y></x>","//y"))))
I hope someone can help, I am looking for a formula solution to the following problem if possible.
I have a column of people's names, and for each of those people I have 3 columns of data from 3 different sources - I need to determine how many times the data in those 3 columns matches for each person. After extensive Googling, I could only find solutions where the result is summarised in a cell derived from a COUNTIF range, however I need the results summarised in the same row for each person.
For example:
"Dave" is in cell A2, his results were: column B2 = FAIL, C2 = PASS and D2 = PASS - so in this instance we have 2 matches as there were 2 passes.
"Sue" is in cell A3, her results were: column B3 = FAIL, C3 = FAIL and D3 = FAIL - so in this instance we have 3 matches as there were 3 Fails.
"Colin" is in cell A4, his results were: column B4 = TBA, C4 = FAIL and D4 = PASS- so in this instance we have 0 matches as none of the results match.
Ideally, I would like the number of matches listed down in column E for each individual person, so Dave's matching results would be cell E2, Sue's would be in E3 and Dave's in E4.
Many thanks in advance for your help.
Kindest regards,
TE
You could try:
Formula in E1:
=INDEX({0,2,3},MAX(COUNTIF(B1:D1,B1:D1)))
A bit of explaination for those who are curious:
COUNTIF(B1:D1,B1:D1) - Will result in an array of three values (1 per column), on how often these values appear in the three cells.
MAX() - Get's the max value from the previous array.
INDEX({0,2,3}) - Since the outcome of MAX() can only be 1-3 we can feed this as the row parameter into an INDEX() function. This will then result in either 0, 2 or 3.
A little less verbose and possibly more explicit would be:
=MIN(((B1=C1)+(C1=D1)+(B1=D1))*2,3)
With this last formula we use the fact that TRUE and FALSE are the equivalent of 1 and 0, and therefor we can add multiple boolean values. With some math we can then get our wanted result.
You can use IF() MAX() and COUNTIF combined.
In E2:
=IF(MAX(COUNTIF(B2:D2,B2),COUNTIF(B2:D2,C2),COUNTIF(B2:D2,D2))=1,0,MAX(COUNTIF(B2:D2,B2),COUNTIF(B2:D2,C2),COUNTIF(B2:D2,D2)))
So it does three separate countif to see how many is "duplicated" from each cell.
Takes the max of them and compare against 1, if that is true then return 0, else return what the max value was.
Would something like this work, in column E?
=if(countif(B2:D2,B2)=3,3,if(countif(B2:D2,B2)=2,2,if(countif(B2:D2,C2)=2,2,0)))
Let me know if that works for you.
I have this data in Excel
A1 = 12
A2 = 10
A3 = 1
A4 = 6
I would like to return the position of the A1:A3 value that is the shortest distance from A4. Therefore you need to compare the ABS(A1-A4) to ABS(A2-A4) to ABS(A3-A4). The answer in this case is 2.
From Excel formula position of minimum value
the answer should be
=MATCH(2,1/FREQUENCY(MIN(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)),(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)))
That returns an error.
Another solution should be
=MATCH(MIN(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)),{ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)},0)
That also returns an error. I know I can calculate the above in multiple steps(cells) or VBA but I need to have one formula that returns the answer. Thanks.
You need the following simple array formula, enter it then press CtrlShiftEnter
=MATCH(MIN(ABS(A1:A3-A4)), ABS(A1:A3-A4),0)
CtrlShiftEnter
I need an excel formula that searches within a range, a cell that contains a word with letter "W" and then multiply the number stored in the cell from the right of it by 2 and display the sum of all this multiplied values in another cell.
Example: Range A4:Y4; B4 contains word "Woo" and C4 contains number "3"; E4 contains word "Wood" and F4 contains number "5"... I need Z4 to contain C4*2+E4*2+...
Please help me with that.
Try this in Z4:
=SUM(SUM(OFFSET($A$4,,IF(IFERROR(FIND("W",$A$4:$Y$4),0)>0,COLUMN($A$4:$Y$4)))))
Hit CTRL + SHIFT + ENTER.
Make sure A4 is not a number (otherwise this formula counts the value of A4 times the number of cells that don't contain "W").
If you want to count cell as well that contain small w's, use SEARCH instead of FIND (SEARCH = case insensitive; FIND = case sensitive).
Keep in mind: OFFSET is a volatile function, i.e. if you have a large datasheet, this might slow down the work a bit.
Found it!
=SUM(IFERROR(2*(LEFT(A4:X4)="W")*B4:Y4,0))
Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.
I have a row that will have weekly values entered. Column B has the initial value, and E has the calculation; as I add values to C, D and so on, I want the calculation to skip the previous columns value when the next column gets a value.
B1-C1=E1 BUT when a value is added to D1, E1 would update to B1-D1=E1
Sorry for the horrible description. This is probably answered somewhere on this site but I am not sure what terms to search.
Many thanks!
you can use an if statement. I am not 100% sure of your problem but something like this might be helpful.
if(A1, A1, 0)
So for your example provided.
=B1-if(D1, D1, C1)
This says if there is a value in D1 use D1 else use C1. This works in this example, because if
D1 is empty or 0 you will use the other cell. This may change for any given problem.
Use this if function in E1:
=IF(D1>0,B1-D1,IF(C1>0,B1-C1,B1))
Then enter a value in B1, then C1 then D1 to see the results.
According to your question, you only have room for two entries after the default B1 value. This statement will handle that.
If you need more fields, nest more if functions. But if's can only be nested 7 deep, so you can only have an initial value in B1 and 7 more cells, C1 to I1 with your formula in J1
If you actual data is as simple as your sample data you could just use:
=IF(LEN(D2)>0, B2-D2,B2-C2)
You could also use:
=IF(ISBLANK(D2), B2-C2, B2-D2)
if you prefer but Len is a little shorter and I believe the ISBLANK() function has flaws, If you have a formula in D2 that has a calculation and you set the result to "" then it will pick up as false. It depends on your needs.
I would do the following.
In E1 paste the following:
=A1-INDEX(B1:D1,1,COUNT(B1:D1))
The count formula will tell how many values are present in the range of B:D column. This will be used to catch the last column with an index formula which will be deducted form A1.
One thing is very important! The values from A to D has to be written in sequence, if one column is missing than the calculation will be false.
Hope I could help!