ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can you nest a MID function within a IF function in Excel (https://www.excelbanter.com/excel-worksheet-functions/16076-can-you-nest-mid-function-within-if-function-excel.html)

Dawn-Anne

Can you nest a MID function within a IF function in Excel
 
My formula for a worksheet is ="2/99/-4/-" &
IF(MID($C$8,7,1)=1,8,MID($C$8,4,1)) & "/980120", where C8 value is
2/02/-1/825100.

Cell returns 2 and not 8 as I had hoped. Any ideas?


Bob Phillips

Hi Dawn-Anne,

You need to test for a string when using MID

="2/99/-4/-"&IF(MID($C$8,7,1)="1",8,MID($C$8,4,1))&"/980120"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dawn-Anne" wrote in message
...
My formula for a worksheet is ="2/99/-4/-" &
IF(MID($C$8,7,1)=1,8,MID($C$8,4,1)) & "/980120", where C8 value is
2/02/-1/825100.

Cell returns 2 and not 8 as I had hoped. Any ideas?




Dawn-Anne

Thanks Bob - worked a treat. Better start glueing my hair back in!

"Dawn-Anne" wrote:

My formula for a worksheet is ="2/99/-4/-" &
IF(MID($C$8,7,1)=1,8,MID($C$8,4,1)) & "/980120", where C8 value is
2/02/-1/825100.

Cell returns 2 and not 8 as I had hoped. Any ideas?



All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com