Combining IF, ISTEXT and LEN functions - excel

My current formula:
=IF((LEN(J3))=4,J3,IF(J3="","",IF(ISTEXT(J3),"",J3)))
What I'm trying to achieve with this formula:
if any cell in column J istext then return as blank.
Shorten 68148101 to show as = 8148
Can't seem to get these two formulas to work together..

Based on you requirements in your comment, try the following in A2:
=IF(J2="","",IF(ISTEXT(J2),"",IF(LEN(J2)>4,MID(J2,2,4),J2)))

Related

Excel CountIf IsFormula?

Is there a way to calculate the count of items in a range, that are a formula?
I'm only expecting =TEXT formulas, so I tried =COUNTIF(1:1, "=TEXT"), but that didn't work. Seems CountIf only operates with the displayed values of the cells.
If I have understood your post clearly, specifically you need those functions which starts TEXT() then perhaps you could try :
• Formula used in cell F6
=SUM(N(IFERROR(LEFT(FORMULATEXT(D6:D19),6)="=TEXT(",0)))
If you have the following in cells A1:A5
=TEXT("493","DDD")
555
=TEXT("420000","YYYY")
Yep
Nope
Either of these formulas should give a result of 2
Counts formulas
=SUMPRODUCT(--ISFORMULA(A:A))
Counts Cells with Formula Text
=SUMPRODUCT(--ISNUMBER(SEARCH("text(",FORMULATEXT(A:A))))

Using Search Formula in Row

Have some problems with one of my formulas in excel.
I have an array of dates, and I want to find if any of them can be found in a cell.
E.g.
C D F G H I J
1 #01/31 #01/30 #01/29 #01/28 #01/27 #01/26 #01/25
And I have my cell A1 containing text: "I want to meet you #01/29"
I get the result I want if I do:
=IF(AND(IFERROR(SEARCH($C$1,A1,1),0)
for each and every of C-J
I would like somthing like
=IF(AND(IFERROR(SEARCH($C$1:$J$1,A1,1),0)
But above do not give anything.
Please help me.
What I want is one formula where I can see if the different dates in C1:J1 can be found in a sentence found in A1.
Two possibilities....
An "array formula"
=IF(COUNT(SEARCH(C1:J1,A1)),1,0)
confirmed with CTRL+SHIFT+ENTER, or a non-array version
=IF(SUMPRODUCT(ISNUMBER(SEARCH(C1:J1,A1))+0),1,0)
You may consider using Match(). It works really well with ranges.
Something like this:
=IFERROR(MATCH(A1,C1:J1,0),0)
Match MSDN
Try this for the wildcard:
=IFERROR(MATCH("*" & A1 & "*", C1:J1 &"", 0), 0)

Vlookup in excel returns NA

I have an excel with 3 columns populated.
The scenario is I want to compare values from column J with H and return the result value from F. I wrote the VLOOKUP but its not returning the values.
Below pasted are the screenshots of this scenario:
VLOOKUP Formula used = =VLOOKUP(J1,$F:$H,1,FALSE)
Is there something wrong with the formula or is there any other way to do it?
Using index match
=INDEX($F:$F, MATCH($J1,$H:$H, 0))
You can't look 'backwards' with VLOOKUP, and whilst it has its bonuses for situations like this always use INDEX MATCH
You could try this =INDIRECT("F" & MATCH(J1,$H:$H,0)).

Passing multiple values to SUMIFS function in Excel

I have Twocolumns A, B ..I am trying to get the sum of A like below.
=SUMIFS(
sheet1!$A:$A,
sheet1!$B:$B, ("AB", "BC", "CD")
)
But this formula is not working.
Please suggest me.
Try to use following formula:
=SUMPRODUCT((sheet1!$B:$B={"AB","BC","CD"})*(sheet1!$A:$A))
or alternatively you can use an array formula:
=SUM(IF(sheet1!$B:$B={"AB","BC","CD"},sheet1!$A:$A,0))
enter formula in the formula bar and press CTRL+SHIFT+ENTER to evaluate it......
If I'm guessing your intention right, you should have:
=SUMIFS(sheet1!$A:$A,Sheet1!$B:$B,"AB")+SUMIFS(sheet1!$A:$A,Sheet1!$B:$B,"BC")+SUMIFS(sheet1!$A:$A,Sheet1!$B:$B,"CD")
Add two helper columns: in D:D you have the list of valid values. In C:C you have a formula like this (change ; to ,). In F1 you have your sum like this:
=SUMIFS($A:$A,$C:$C,FALSE)
Now you can add any number of valid criteria in column D:D.
You can use SUMIFS to return an array (one for each criterion) and then SUM to sum those, i.e.
=SUM(SUMIFS(sheet1!$A:$A,sheet1!$B:$B,{"AB","BC","CD"}))
This way retains the speed and efficiency of SUMIFS without needing repetition
If you have your criteria values in a range of cells you can simply reference the range, but use SUMPRODUCT to avoid "array entry"
=SUMPRODUCT(SUMIFS(sheet1!$A:$A,sheet1!$B:$B,Z2:Z4))
where Z2:Z4 contains the criteria
Note: in both of these SUMIFS does all the "heavy lifting" - SUM/SUMPRODUCT is used simply to sum the resulting array

Excel SUM and IF combine help

I have two columns of numbers. Both are 1 to 5. I want to count all the cells where the left column value equals the right column value AND the left column value equals a certain value.
I tried this:
=SUM(IF(W2:W13=X2:X13 AND W2:W13=4,1,0))
I've tried pressing Ctrl+Shift+Enter and it adds {} around the formula but that didn't help either.
I think it's the W2:W13 = 4 part that doesn't work
=COUNTIFS(W2:W13,"=4", X2:X13, "=4")
You can use the sumif() function:
SumIf( range, criteria, sum_range )
it will apply the criteria for each row in the range.
Edit: to count the matches, you can use sum_range = 1 or use the Countif() function suggested by Ben in his answer
Have you considered a third column (C) with the formula IF(A1=B1,1,0) and then summing that third column?
I'm not much of an Excel Expert, but didn't they craeted the COUNTIF(range, criteria) function for this?
Add a third column eg Z2:Z13 with this formula: IF(AND(W2=X2; W2=4); 1; 0)
Then sum that one.
I don't have Excel 2007. So here's how you can do it in Excel 2003:
=COUNT(IF((W2:W14=4)*(X2:X14=4),Y2:Y14))
Since you are looking for a specific value and the column next to it to be the same value, you can just compare both columns to the same value.
The trick to get this to work is after entering the formula you need to hit F2 to go into edit mode and then hit CTRL-SHIFT-ENTER which makes this formula an array formula. This will put {} around the entire formula. Without making this an array formula this formula won't work.
I found this information in the Excel help document titled Count how often a value occurs

Resources