corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Can anyone simplify this Excel formula » Post Reply

Post Reply
Who Can Post? All users can post new topics and all users can reply.
Icon:
Formatting Mode:
Normal
Advanced
Help

Insert Bold text Insert Italicized text Insert Underlined text Insert Centered text Insert a Hyperlink Insert Email Hyperlink Insert an Image Insert Code Formatted text Insert Quoted text
Message:
HTML is Off
Smilies are On
BB Code is On
[img] Code is On
Post Options: Disable smileys?
Turn BBCode off?
Receive email notification of new replies?

Ojc

posted on 29th Dec 14 at 21:59

I used to do this


nibnob21

posted on 16th Dec 14 at 18:07

God I dislike Excel.

Get yourself MATLAB.


evilrob

posted on 16th Dec 14 at 14:50

quote:
Originally posted by Steve
don't understand the <9,4,5 bit though, its to do with checking if before sept the 1st but how do those numbers equal that?

If the month is less than 9 (i.e. September) add 4 years to arrive at YOE, otherwise add 5.


evilrob

posted on 16th Dec 14 at 14:50

No probs. :cool:

I'm sure Dom will be along with a formula that pisses all over my 62 character effort.


Steve

posted on 16th Dec 14 at 14:42

don't understand the <9,4,5 bit though, its to do with checking if before sept the 1st but how do those numbers equal that?


Steve

posted on 16th Dec 14 at 14:36

Awesome :thumbs:

I knew there must be a simpler way of doing it, thanks :)


evilrob

posted on 16th Dec 14 at 14:32

Leading zero should be sorted too

[Edited on 16-12-2014 by evilrob]


evilrob

posted on 16th Dec 14 at 14:32

Ah, I see.

Try this:
=RIGHT(YEAR(C1)+(IF(MONTH(C1)<9,4,5)),2)&LEFT(A1,1)&LEFT(B1,4)


Steve

posted on 16th Dec 14 at 14:31

Similarly if you input 2000 as the DOB it produces

4AZhu

needs to be

04AZhu


Steve

posted on 16th Dec 14 at 14:27


Data input is the same, and works fine in mine too with your example, its if the years fall between 00 and 10

try it on yours and you will see


evilrob

posted on 16th Dec 14 at 14:26

I can't really help without seeing your input data.

Here's it working:
http://cl.ly/2S0V0n393k1o/Book1.xlsx


Steve

posted on 16th Dec 14 at 14:26

that's only the case for years after 99 though <00 works fine

[Edited on 16-12-2014 by Steve]


Steve

posted on 16th Dec 14 at 14:24

ok its sort of working now, but its sticking a 1 infront of the year so its outputting

100AZhup
should be
00AZhup

[Edited on 16-12-2014 by Steve]


evilrob

posted on 16th Dec 14 at 14:20

Is your DOB stored as a date or text?


Steve

posted on 16th Dec 14 at 14:19

it just says #value

I wonder, what format does the DOB need to be in? atm its dd/mm/yy


Jimbothebarbarian

posted on 16th Dec 14 at 14:16

Walks in reads thread, walks out dumbfounded.....


evilrob

posted on 16th Dec 14 at 13:57

=RIGHT(YEAR(C1),2)+(IF(MONTH(C1)<9,4,5))&LEFT(A1,1)&LEFT(B1,4)

A1 = First name
B1 = Last name
C1 = DOB

[Edited on 16-12-2014 by evilrob]


Steve

posted on 16th Dec 14 at 13:48

so I managed to create a formula to work out a childs intake year in yy format based on their full DOB, by breaking down each step and adding it to the formula bit by bit

The complication is because year of entry is from sept to sept, someone born in the same year could fall under a different YOE if they were born before or after sept 1st.

The formula also takes the first initial and last 4 characters of the surname and appends the DOB, so for instance would create 01SWill.

Here is what I have

=TEXT(DATE(YEAR(C722),MONTH(C722)+48+IF(AND(C722>DATE(TEXT(C722,"yyyy"),8,31),C722<DATE(YEAR(DATE(TEXT(C722,"yyyy"),8,31)),MONTH(DATE(TEXT(C722,"yyyy"),8,31))+12,DAY(DATE(TEXT(C722,"yyyy"),8,31)))),"12", "0"),DAY(C722)),"yy")&LEFT(A722,1)&LEFT(B722,4)

it works perfectly, but it looks over complicated, anything I can do with that to shorten it? for no other reason than if anyones bored and fancies a challenge :lol: