How to combine and if statement with a formula to concatenate? - excel

Trying to combine two formulas together but can't figure out how to get them to work. The concatenate formula is
=IF(OR(UPPER(D6)="",UPPER(D6)="N"),A6,A6&" - "&D6)
The formula was created so that if "Y" was entered in a checkbox (yes), then it would combine two different parts to create a result in a separate box. If "N" is entered then it would not concatenate.
The formula was originally
=IF(OR((AND((A6<>""),(D6<>""))),(AND((B6<>""),(D6<>"")))),IF(A6="",B6,A6),"")
I'm trying to figure out how to put a concatenate formula somewhere in this one, haven't had any luck so far.. Thank you.

Most Excel worksheet formulas are not case sensitive, so you don't need UPPER().
Your original formula has a logic error. It can only return TRUE if A is NOT blank. But in the TRUE part, you have another IF statement that is only TRUE if A6 is blank. That situation never happens.
How complicated the formula will be depends on what the logic is. If the result should always be one thing for "n" or a blank input, and another thing for a "y" input, maybe you only need to test for "y" instead of testing for "" and "n".
=if(and(A1="y",B1="y"),X&" - "&Y,X)
If that does not answer your question, please edit your question, provide a data sample and the desired result and explain the logic. Then post a comment, so people get alerted about the update.

Related

How to convert code formula to excel data validation formula

I don't have any experience with creating excel data validation formulas.
I have 2 code formulas, which are generated in java code, which are coming from excel data validations:
COUNTA('User Input Sheet'!A:A)-4
IF(COUNTA(INDIRECT(ADDRESS(ROW(A5),COLUMN(A5),1,1,"User Input Sheet") & ":" & ADDRESS(ROW(AJ5),COLUMN(AJ5))))=0, "","POP")
Can someone help me how to write the data validation formula for the above two, as I have to use for different cells, but don't know how to put in cell data validation ?
Providing more information on what it is you're actually trying to do, will help you, as well as helping anyone who's trying to help you. e.g.:
Your 1st formula returns the number of non-empty cells in column A of a sheet, less 4.
But you don't say if the cell being validated needs to be more, less, the same or not the same as that. If you know the answer to that, the formula as is (with = in front) will work directly in the Data Validation 'value range' fields. e.g.:
The above example validates that a cell value is between zero and the results of the formula.
Suggest adapting and applying that, and if you're not getting the expect result, explain what you were aiming for, what you did, and what the results are.
=====================================================
The second formula is more problematic in terms of trying to guess what it is you're trying to do.
One thing I'll point out first thought: it uses INDIRECT in a completely unnecessary way (and that's inherently unwise). So the first thing to do is covert to a direct reference per:
=IF(COUNTA('User Input Sheet'!A5:J5)=0, "","POP")
But even then, you have a formula that returns a zero-length string ("") or literal 'POP' (based on A5:J5 being empty or not).
And it's unclear how you intend to use that to validate a cell. One guess would be the user has to enter "POP" or nothing (depending on A5:J5 being populated or not). But that seems to be an odd thing to do.

In Excel which formula can write that would easily identify if my output condition is true or false

I am trying to do an excel formula calculated response in regards to comparing the values of three cells.
I have three cells and if one or more cell is populated with a value of greater than "0" I want it to return mix and if false ignore
Yes, actually you're correct you'll need to use COUNTIF or IF. The function IF should be good enough depending on your formula.
Please try to use the formula how I had in illustrated in my image. =IF(D3>TODAY(),"YES","NO"), your formula would be different depending on your values or if you're using dates.
If you're not using dates you can still just use IF plus the AND functions like this "=IF(AND(B3,C3,D3)<="","TRUE","FALSE")", see my linked file to see how I did it. Good luck!
Tip, you can check for "0"(a number) or ""(which means blank).
Check Value in 3 Cells for TRUE-FALSE example in excel.
Screenshot that might help understand how I use '=IF(AND...' Functions to do just what you originally asked.
To answer the revision to your question I would recommend referencing Microsofts resource on CONCAT function Combine text and numbers
Conversely, I've worked out an example for you. =IF(E4>0,(CONCAT("YES: B4:D4 ="," ",(TEXT(C4,"MM/DD/YY"))," + ",(TEXT(D4,"MM/DD/YY"))," + ",D4," Total Days")),"NO") which references my example screen shot here:
The use of "IF" plus the "CONCAT" function to return the mix of three or more cell values.

Double nested IF statement formula in Excel

Good morning,
I would like to set a multiple if statement in Excel.
In row 8 you can see the following formula, which gives an answer in column Q. The answer based on this nested formula is Yes or No.
In row 13 all the cells are empty. Because the nested formula has been dragged down it still shows "No".
I was trying to write some double nested IF statement for this, which could cover the situation when the cells are empty and the Q column can come empty as well as a result.
=IF(OR(M9=" ",OR(N9=" ",OR(O9=" ",OR(P9=" "(IF(OR(M9="No", OR(N9="No", OR(O9="No",OR(P9="No")))))),"Yes","No")," ")
Unfortunately, the formula is not working.
Is it a possibility to add up an additional condition for the nested IF statement in Excel?
Something like:
=IF(COUNTA(M2:P2),<YourFormula>,"")
Where <YourFormula> is a placeholder for whatever formula you are interested in when any value in M2:P2 has a value.
As #JvdV has noted in comment above, your latest formula in comment above is still checking for a space, not a null (empty) cell.
Writing " " will look for a cell that contains a space (someone has hit spacebar). Writing "" will check to see if a cell contains nothing, in other words check to see it is empty.
I also noticed the error in your re-write: You wrapped the logical test within the parenthesis for the COUNTA formula. This is your formula corrected:
=IF(COUNTA(M9:P9)=0,(OR(M9="No",OR(N9="No",OR(O9="No",OR(P9="No"))))),"")
However, each OR statement gives a TRUE or FALSE result and can handle multiple arguments, as indicated by #SolarMike so I think you could probably re-write your formula to as follows to get the same result, if I have understood your requirements correctly:
=IF(COUNTA(M9:P9)=0,IF(COUNTIF(M9:P9,"No")>0,"Yes","No"),"")

Shortening COUNTIF formulas in Excel

I'm not sure if this is a duplicate question, I've tried looking around but I don't see any duplicates. Pardon me if I'm wrong.
I've got a simple formula that I stacked many times to give me my end result, but I feel like it's too long.
I have 2 questions:
1) What can I do to shorten this super-long mess of a formula I've come up with; and
2) Is there a better way to do it?
I need someone to at least point me in the right direction to get started.
This is the formula: =IF((COUNTIF(B1:B10,"VC1"))=1,IF((COUNTIF(B1:B10,"VC2"))=1,IF((COUNTIF(B1:B10,"VC3"))=1,IF((COUNTIF(B1:B10,"VCG1"))=1,IF((COUNTIF(B1:B10,"VCG2"))=1,IF((COUNTIF(B1:B10,"X"))=1,IF((COUNTIF(B1:B10,"XM"))=1,IF((COUNTIF(B1:B10,"XG"))=1,IF((COUNTIF(B1:B10,"P"))=2,"10","P"),"XG"),"XM"),"X"),"VCG2"),"VCG1"),"VC3"),"VC2"),"VC1")
Basically, I have text in cells B1 to B10, each with unique values.
In case it's needed, the values are (not in order): X, XM, XG, VCG1, VC1, VC2, VC3, VCG2, P, P.
A different cell will have the formula that I mentioned, to ensure that each cell has a very specific text defined, or else it'll show an error message.
Because of this, I also have another question:
3) What can I do to make it such that I can search (or COUNTIF) all the values from B1 to B10, and make sure that there's an exact number of values with very specific texts inside, without it going in order of the formula?
To explain this further, the formula does an IF, then a COUNTIF. If the COUNTIF succeeds, it will move on to the next COUNTIF inside the value for the result. Because of this, I can't print multiple "errors" at once, and it goes for each "error" one by one, which can be confusing to the end user.
It might be something else than what you want, but what if you use something like this?
=(COUNT(B1:B10;"VC1")=1)*1&
(COUNT(B1:B10;"VC2")=1)*1&
(COUNT(B1:B10;"VC3")=1)*1&
(COUNT(B1:B10;"VCG1")=1)*1&
(COUNT(B1:B10;"VCG2")=1)*1&
(COUNT(B1:B10;"X")=1)*1&
(COUNT(B1:B10;"XM")=1)*1&
(COUNT(B1:B10;"XG")=1)*1&
(COUNT(B1:B10;"P")=2)*1
it would create a string of zeroes and ones (false and true) and from this you would be able to identify if something is wrong and even how many errors occured and why.

"IF" formula in excel using multiple conditions

I need help with an "IF" formula in excel using multiple conditions. This is what I need:
IF (cell) is <201, then *$2, if (cell) is 201-400, then *$1.15, if (cell) is >400, then *$1)
I am trying to create a "settlement" spreadsheet.
You may try this:
=IF(A1<201,"2",IF(AND(A1>201,A1<400),"1.15",1))
However, you've not mentioned what do you want to do when cell value is 201. If you want it to result in $2 then change formula to A1<=201 or else if you want it to result in $1.15 then write A1>=201 and same aplies to 400.
EDIT :
=IF(A1<=200,"2",IF(AND(A1>200,A1<=400),"1.15",1))
How many IF statements are you needing to string together? You are on the right track, they just get confusing the more you need to string together.

Resources