IF(LEN) Function

shanenicholson88

New Member
Joined
Oct 6, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
 
Upvote 0
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..
 
Upvote 0
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,963
Messages
6,122,484
Members
449,088
Latest member
Melvetica

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