istext

uk747

Well-known Member
Joined
Jul 20, 2011
Messages
832
Office Version
  1. 365
Platform
  1. Windows
=IF(ISTEXT(a3),a3,IF(ISTEXT(a2),a2,"")) cant seem to get the formula to work.A3 contains a formula and A2 doesnt. If the formula in A3 shows text based on a result then I want contents of A3 in A1, if A3 is "" then show A2 and if A2 is blank then ""
 
thankyou and apologies for not spotting your post
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Sixthsence,

I have run this through formula evaluator but still fail to see what the formula is doing differently to the formula with out the the LEN function,

could you please tell me what is happening and why it returns where the basic formula does not.

Thanks in anticipation.
 
Upvote 0
In a blank worksheet do this exercise.

Keep A1 as blank

In B1 cell
=IF(A1=1,1,"")

In C1 cell
=ISTEXT(B1)

In D1 cell
=LEN(B1)

In E1 cell
=AND(LEN(B1),ISTEXT(B1))

Now you can see B1 seems to be empty but it's not completely empty for display it's seems to be empty, but actually B1 has been turned as Text due to "" in B1 cell formula.

So C1 formula =ISTEXT(B1) is returning TRUE but when we use Len Function to determine the Number of characters it returns 0.

The E1 cell formula =AND(LEN(B1),ISTEXT(B1)) will check whether both the conditions (i.e. Condition1 and condition2) returns TRUE.

Anything Greater Than Zero will be treated as TRUE and Zero will be treated as FALSE.

So the Len Function Returns 0 which will make the AND function to return FALSE.

Hope it's clear now :rolleyes:
 
Upvote 0
Here's another possibility that I think does what you want. It would also easily adapt to a larger range.

Assuming you have Excel 2007 or later:
=IFERROR(LOOKUP(2,1/(A2:A4<>""),A2:A4),"")

For earlier versions:
=IF(ISNA(LOOKUP(2,1/(A2:A4<>""),A2:A4)),"",LOOKUP(2,1/(A2:A4<>""),A2:A4))
 
Upvote 0
Thanks,

Great explanation.

Thats clear now,

Also i had missed out the and section of the formula when I evaluated it.
 
Upvote 0
Or you can ignore Len Function and write it in this way...

Code:
=IF(AND(A4<>"",ISTEXT(A4)),A4,IF(AND(A3<>"",ISTEXT(A3)),A3,IF(AND(A2<>"",ISTEXT(A2)),A2,"")))

Edit: Oops.. Peter_SSs explained this method in Post #15
 
Last edited:
Upvote 0
Or you can ignore Len Function and write it in this way...

Code:
=IF(AND(A4<>"",ISTEXT(A4)),A4,IF(AND(A3<>"",ISTEXT(A3)),A3,IF(AND(A2<>"",ISTEXT(A2)),A2,"")))

Edit: Oops.. Peter_SSs explained this method in Post #15
I don't think I did anything about explaining that method??

In any case, if we can believe the OP ..
the result of the formula is text.
.. then there should be no need to test for text values. My understanding is that the OP's formulas in A2:A4 return "" (text) or some other text. You also can shorten a bit by testing equality, rather than inequality. So if you want to keep the nested IFs then maybe

=IF(A4="",IF(A3="",IF(A2="","",A2),A3),A4)
 
Upvote 0

Forum statistics

Threads
1,215,762
Messages
6,126,737
Members
449,334
Latest member
moses007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top