Mid function question.

JayLee

Board Regular
Joined
Sep 23, 2002
Messages
52
In my worksheet, I have:
[Y2]
=MID(D2,FIND("@",D2),7)

Sometimes it returns "#VALUE". I want it to look in another column if that comes up. I would think to use an IF formula to do this. But if I do:
[Z2]
=if(Y2="#VALUE", G2, "")

Unfortunately that doesn't work. How can I just use an IF formula on the MID function to catch the error? Thanks in advance!!!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
On 2002-10-07 16:39, JayLee wrote:
In my worksheet, I have:
[Y2]
=MID(D2,FIND("@",D2),7)

Sometimes it returns "#VALUE". I want it to look in another column if that comes up. I would think to use an IF formula to do this. But if I do:
[Z2]
=if(Y2="#VALUE", G2, "")

Unfortunately that doesn't work. How can I just use an IF formula on the MID function to catch the error? Thanks in advance!!!


=IF(ISNUMBER(FIND("@",D2)),MID(D2,FIND("@",D2),7),MID(G2,FIND("@",G2),7))

Or...

=IF(ISNUMBER(FIND("@",D2)),MID(D2,FIND("@",D2),7),IF(ISNUMBER(FIND("@",G2)),MID(G2,FIND("@",G2),7),"Not Found"))
 
Upvote 0
How's the ISNUMBER function really work?

I'm thinking of using it to:
=abs(P2)

If there is no number, how can i use the ISNUMBER function to display "" in current cell?

Thanks for all your help!
 
Upvote 0
On 2002-10-07 17:33, JayLee wrote:
How's the ISNUMBER function really work?

I'm thinking of using it to:
=abs(P2)

If there is no number, how can i use the ISNUMBER function to display "" in current cell?

Thanks for all your help!

=ISNUMBER(P2)

returns TRUE if P2 houses a number like -7, 0, 23.2, or 4, otherwise FALSE.


=IF(ISNUMBER(P2),ABS(P2),"")
This message was edited by Aladin Akyurek on 2002-10-07 17:42
 
Upvote 0
Here's another approach...

=IF(LEN(D2)<FIND("@",D2&"@"),G2,MID(D2,FIND("@",D2),7))

...and, if you were to enter the formula, =FIND("@",D2&"@"), into another cell (e.g., E2) as an intermediate result the formula above could be further simplified to...

=IF(LEN(D2)<E2,G2,MID(D2,E2,7))
This message was edited by Mark W. on 2002-10-07 22:04
 
Upvote 0

Forum statistics

Threads
1,218,899
Messages
6,145,093
Members
450,590
Latest member
Naneng

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