Avatar of wexas
wexas

asked on 

Excel - VBA

Hello Experts

Can you please assist me this, i need to write user defined function on Excel where by i can allocate the join period of a member based on number months since member joined.  I tried doing this on MS access query but it doesn't work.

Attached is the sample data i need to polulate column L, for example if join period is between 0-3 months then "0-3 M", if between 0-6m then "0-6 m" and so on
Excel-VBA-join-Period.xls
Microsoft Excel

Avatar of undefined
Last Comment
Flyster
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Does this do what you want:
=IF(K2>12,"12+","0-"&LOOKUP(K2,{0,4,7},{3,6,12}))&" months"
ASKER CERTIFIED SOLUTION
Avatar of Flyster
Flyster
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of wexas
wexas

ASKER

perfect answer
Avatar of Flyster
Flyster
Flag of United States of America image

Thank you. I would be remiss, however, if I didn't point out that rorya's solution was just as effective and a lot more eloquent then a nested if.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo