Combining IFERROR and LEFT Formulas - excel

I have a formula that looks like this
=IFERROR(B83,"OPEN")
So if a certain cell has an error it changes it to OPEN, but if it doesn't then it returns the values within that cell.
I am trying to make the cell also short the text that is being returned to 7 characters.
I made this formula:
IFERROR(B83,"OPEN"),AND(LEFT(B83,7))
However it does not work and instead returns an "NA".
Appreciate any help.

Try
IFERROR(LEFT(B83,7),"OPEN")
You need to put your desired result as the first argument of IFERROR.

Related

condition formatting based on formula's result

I have a cell (AP21) containing a formula, and I want that the AP22 become black if the AP21 return empty string.
I am using conditionnal formatting but I not able to do that, because when I am using a formula to check the value of AP21, it's always considered as not empty because it contains a formula and not a text.
What I need is to evaluate in my AP22 the result of the formula of the cell AP21 and not the formula itself.
Any clue about how to do that please ?
Here is what I have to help you to understand me more
I tried also what is suggested in comments still didn't work
As #BigBen said in comments, you want to compare to an empty string
=$AP21=""

How to contain formulas within a formula?

I am trying to have formula return with a cell population with the first six characters of the look up cell given that the first two characters are 10.
See below for example.
=IF((LEFT(A3,2)=10), LEFT(A3,6), "")
As of right now, I keep getting a blank return no matter the look up cell's information.
This works for me:
=IF(LEFT(A3,2)="10",LEFT(A3,6),"")
LEFT returns a text string so you need ". You also don't need the double brackets.
You can aslo force the result of left() to be numerical,
=IF(LEFT(A3,2)*1=10,LEFT(A3,6),"")
I used *1, but +0 can work.
see
This can be convenient if you want to have the values like 10 or 15 etc in separate cells so you can just drag down.
See
You could use a cell to tell left() how many characters to collect or use the len() function.

IF function with two cell ranges

I have two sheets with the same line of cells, for example, A1:A5.
I need to check if the value of every cell in Sheet1!A1:A5 is equal to Sheet2!A1:A5 but the hitch is the values will be letters, and all values are different. Simply typing the formula got me a #VALUE! error.
I know I can just write the formula:
=IF(Sheet1!A1=Sheet2!A1;1;0)
and then simply retype it in a number of cells with different values, but I'm looking for a way to shorten the formula.
Any suggestions?
To shorten the formula use array function. With that you will be able to check the whole range at once.
=IF(AND(Sheet1!A1:A5=Sheet2!A1:A5);1;0)
After typing the formula press Ctrl+Shift+Enter instead of just Enter key to confirm array formula.
This one is a little shorter
=(Sheet1!$A1=Sheet2!$A1)
You could use
AND(EXACT(Sheet1!A1, Sheet2!A1), EXACT(Sheet1!A2, Sheet2!A2), EXACT(Sheet1!A3, Sheet2!A3), EXACT(Sheet1!A4, Sheet2!A4), EXACT(Sheet1!A5, Sheet2!A5))
But in the following way:
Have a separate column with the code (let's say, column G)
EXACT(Sheet1!$A1, Sheet2!$A2)
To the column next to that, have a single cell with the code
AND(G1:G5)
Use the AND() function:
IF(AND(Sheet1!A1=Sheet2!A1,Sheet1!A2=Sheet2!A2,Sheet1!A3=Sheet2!A3,Sheet1!A4=Sheet2!A4,Sheet1!A5=Sheet2!A5),1,0).
EDIT
Not realy sure about your aim,
If you want it short because it is too difficult to write the above function, then try the method below:
=IF(CONCATENATE(Sheet2!A1,Sheet2!B1,Sheet2!C1,Sheet2!D1,Sheet2!E1)=CONCATENATE(Sheet1!A1,Sheet1!B1,Sheet1!C1,Sheet1!D1,Sheet1!E1),1,0)
But this is not without catch, it could return false positive. So use it with care. To overcome the false positive, I could only make the formula longer (but still relatively easy to write out).
=IF(CONCATENATE(Sheet2!A1,"|",Sheet2!B1,"|",Sheet2!C1,"|",Sheet2!D1,"|",Sheet2!E1)=CONCATENATE(Sheet1!A1,"|",Sheet1!B1,"|",Sheet1!C1,"|",Sheet1!D1,"|",Sheet1!E1),1,0)

Using "INDIRECT" function in the "SUMPRODUCT" formula for True/False Cell Reference

This is the formula that I am currently using:
=SUMPRODUCT((INDIRECT("A2"):INDIRECT("A"&(ROW()-1))=A359)*1)
It works great, but I would like to use this instead:
=SUMPRODUCT((INDIRECT("A2"):INDIRECT("A"&(ROW()-1))=INDIRECT("A"&(ROW())))*1)
Unfortunately I get a #VALUE!. What am I doing wrong? Both INDIRECT("A"&ROW(())) and A359 return the same value, so I'm not sure why this won't work.
The reason I am not using a simple COUNTIF function is because I stripped my formula of all unnecessary components and only left the part that I am having trouble with (i.e. I need to use the SUMPRODUCT formula and a COUNTIF formula will not work)
Thanks in advance!
I'm not sure why you need INDIRECT instead of ordinary cell references but the specific problem here is that ROW function returns an "array", even when it returns a single value, e.g. it returns {"x"} rather than just "x" - and in some circumstances Excel can't process that.
Try wrapping the second ROW function in a SUM function - the value doesn't change but it gets rid of the array, i.e.
=SUMPRODUCT((INDIRECT("A2"):INDIRECT("A"&(ROW()-1))=INDIRECT("A"&SUM(ROW())))*1)
This will eliminate #VALUE! eror while leaving the essential structure of your formula unchanged
Try this one:
=SUMPRODUCT((($A$2:INDEX($A:$A,ROW()-1))=INDEX($A:$A,ROW()))*1)
it gives you the same result.
But above formula is volatile. Instead I would use next one, say in B3 :
=SUMPRODUCT((($A$2:$A2)=$A3)*1)

Error with Nested Excel IF formula

=IF(ISBLANK(BLANK(CG3),"",(IF((LEFT(CG,2)="/m"),"mcat||"&CG3,"icat||"&CG3)))
I am getting a #NAME? error on the above formula.
CG3 contains either /mcat/... OR /icat/... currently. I need to add the prefix "mcat||" or "icat||" depending on the text currently there. Also, if CG3 is blank I want it to remain blank.
2 Issues:
Missing parenthesis in the ISBLANK function. (On second thoughts, this looks like a copy/paste issue.)
Missing cell number in the LEFT function.
Should be:
=IF(ISBLANK(CG3),"",IF(LEFT(CG3,2)="/m","mcat||"&CG3,"icat||"&CG3))

Resources