Tuesday, 19 April 2016

Find First Non-Blank in a range

Find First Non-Blank in a Range :-

Let's suppose you have a range as in our example, C2:H2, C3:H3 and so on.. And in each range , you want first non-blank value.

For that, you can use formula:
=INDEX(C2:H2,MATCH(FALSE,ISBLANK(C2:H2),0))


Lets break the formula for better understanding:

1) ISBLANK(C2:H2) >> It brings the result as True or False.

2) MATCH(FALSE,ISBLANK(C2:H2),0)) >> Here , we are using match function to match the False with isblank as we have to find not blank cell value.
0 ('zero'), represent Exact match.
It will give you the position of first non-blank cell.

3) After that index function gives you relative position cell value.
INDEX(C2:H2,MATCH(FALSE,ISBLANK(C2:H2),0))

Thanks!!
Keep Practicing!!

Monday, 11 April 2016

Calculate the Age of a Person in Excel

Calculate the Age of a Person:


To claculate the age of a person, you can use TEXT function.
Formula to calculate the Age of a person:
=TEXT(NOW()-A3,"yy"" years ""m"" months ""dd"" days """) - where A3 is date of birth (DOB)




Formula is based on:
1) First , Calculate the difference of today date and date of birth i.e NOW()-A3
2) Then , format it with Text function in years months and days. TEXT(NOW()-A3,"yy"" years ""m"" months ""dd"" days """)

YEARFRAC along with INT function can also be used to find the age of a person (no. of years)
INT(YEARFRAC(A3,TODAY()))

Although DATEDIF function is not documented in Excel 5, 7 or 97, but it is in 2000.
You can also use DATEDIF function to calculate the age of a person.
DATEDIF(A3,TODAY(),"y")
DATEDIF(A3,TODAY(),"ym")
DATEDIF(A3,TODAY(),"md")

Thanks

Random Phone Number in Excel



Create Random Phone Number:


Formula to Create Random phone number:
=RANDBETWEEN(1000000000,9999999999)

Enter above formula in any cell for random phone number.

And , After that Format the cell as phone number (Right Click>> Format Cells >> Number >> Special >> Phone Number).