# IF(LEN) Function

#### shanenicholson88

##### New Member
Good morning all,

I have the following formula on one of my spreadsheets, written by an excel wizard. I am trying to figure out what exactly this is doing. I know what the functions do individually, but not like thiis.
Any help will be much appreciated, and thank you in advance to taking the time to read it.

Excel Formula:
=IF(LEN(M6)=3,LEFT(M6,1),LEFT(M6,2))*100

### Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

#### alansidman

##### Well-known Member
If the length of cell M6 is equal to 3 then put the first character in M6 and multiply it by 100. If the length of M6 is something other than 3 then the first two characters of M6 and multiply by 100.

Example: M6 = 125 then the result would be 1 times 100 or 100
If M6 = 1250 then the result would be 12 times 100 or 1200

#### shanenicholson88

##### New Member
If the length of cell M6 is equal to 3 then put the first character in M6 and multiply it by 100. If the length of M6 is something other than 3 then the first two characters of M6 and multiply by 100.

Example: M6 = 125 then the result would be 1 times 100 or 100
If M6 = 1250 then the result would be 12 times 100 or 1200

Thats very kind of you to get back to me so quickly, much appreicated.
OK, so in cell M6 I have a date

08-JUN-01 or 08/06/1901 and in the cell this formula is in, I get the result 500.

Any Idea?

Thanks again Alan..

#### alansidman

##### Well-known Member
Excel dates are just numbers formatted to look like dates. Look at this link to understand

June 6, 1901 is the numerical equivalent of 525. Hence 5 times 100 is the result.

#### shanenicholson88

##### New Member
Excel dates are just numbers formatted to look like dates. Look at this link to understand

June 6, 1901 is the numerical equivalent of 525. Hence 5 times 100 is the result.

You have seriously made my day! Thank you so much for explaining that..

#### sandy666

##### Banned - Rules violations
Book1
MN
608/06/1901500
708/06/1901800
Sheet1
Cell Formulas
RangeFormula
N6N6=IF(LEN(M6)=3,LEFT(M6,1),LEFT(M6,2))*100
N7N7=IF(LEN(TEXT(M7,"dd/mm/yyyy"))=3,LEFT(TEXT(M7,"dd/mm/yyyy"),1),LEFT(TEXT(M7,"dd/mm/yyyy"),2))*100

the result depends on what formula you use

Last edited:

Replies
15
Views
234
Replies
5
Views
421
Replies
7
Views
252
Replies
1
Views
100
Replies
3
Views
123

1,181,847
Messages
5,932,437
Members
436,838
Latest member
rparthireddy

### 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.

### Which adblocker are you using?

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

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