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!!!
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
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"))
 

JayLee

Board Regular
Joined
Sep 23, 2002
Messages
52
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!
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201

ADVERTISEMENT

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
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,463
Messages
5,596,284
Members
414,051
Latest member
tabecker

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
Top