+ Reply to Thread
Results 1 to 19 of 19

More complex lookup formula help (sickness conditions)

  1. #1
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    More complex lookup formula help (sickness conditions)

    This question is related to another question I asked a couple of days ago (http://www.excelforum.com/excel-gene...condition.html)
    To recap;
    I’ve got a long spreadsheet with many rows (>5000). Each row relates to a time someone has been off work sick. In two columns (D and G) I have “reasons” for sickness and “Days lost” due to sickens respectively.

    I have set up a look-up type formal to search for the reasons for sickness (=COUNTIF($D$4:$D$5955,I4), which obviously simply counts the number of times “stress”, for example, appears in my list.

    I’ve now got a formula that counts the number of days lost per condition (i.e. it finds all the “stress” and finds the number next to it, and add that up). =SUMIF(D$4:D$65536,"Stress",G$4:G$65536)

    What I’m wanting to do now (if possible) is group conditions together and get excel to count number of days instances and days lost the group. For example stress would be grouped with depression and anxiety as “Emotional Health”. I don’t know if this is the why to go but I’ve created another worksheet. On that sheet, column A rows 2-12 contain all the conditions I want to fall into the Emtional_Health group. The group was named by highlighting A2-12 and naming it in the Name Box.

    Am I on the right lines? Where do I go from here?

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: More complex lookup formula help (sickness conditions)

    A sample workbook will be useful
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: More complex lookup formula help (sickness conditions)

    Please attach a sample workbook with dummy data covering the expected output for better understanding


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: More complex lookup formula help (sickness conditions)

    Hi burnsie,

    Please upload a sample workbook along with your expected output. Thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  5. #5
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    1.xls

    Hope that's worked?

    Sheet "data" is all the raw data.
    "Sheet 2" is where the groups are defined.

    Ive obviously has to edit the data somewhat.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: More complex lookup formula help (sickness conditions)

    Just wanted to reduce your manual work.

    In G4 cell of Data Sheet
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag it down...

  7. #7
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    hi.

    that doesnt seem to change anything already.

    In case ive not explained it correctly.

    using an example; In "Sheet 2" you can see a group called "Blood_disorder". In this group there are five conditions (Anaemia, Blood Disorder (Unspecified), Bruising – General, Hyponatremia, Sepsis (Blood Infection))

    What im wanting is excel to count how many times these conditions appear, ie so the above would = 97 days lost.

  8. #8
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: More complex lookup formula help (sickness conditions)

    Do you mean this?
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    ooo, yes...getting closer.

    so, if a create a "group" coloum in coloum B, how do i get excel to look at coloum C (for condition) and then change the name of B due to what "group" that conidition fits in to.

    ie I finds Anaemia in C, looks at Sheet 2, finds Anaemia in the "Blood_disorders" group and therefope the result in "Data" sheet, coloum B becomes "Blood_disorders"?

  10. #10
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: More complex lookup formula help (sickness conditions)

    Choose first the 'group' and then the 'reason'.
    You can then only choose a reason that fits the group.

  11. #11
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    Quote Originally Posted by popipipo View Post
    Choose first the 'group' and then the 'reason'.
    You can then only choose a reason that fits the group.
    Going forward, yes, but this is data collected from a database and therefore I’m trying to analyse it retrospectively

  12. #12
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: More complex lookup formula help (sickness conditions)

    Try this formula in Cell B4 :
    Please Login or Register  to view this content.
    Enter the value and then press Ctrl-Shift-Enter. This will place {} brackets around the formula, indicating that it is an array.
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  13. #13
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    sorry, im being very dumb here.

    What "value" should i enter?

    With the {} i get an error box.

    With the {} it the formula is just text

    I wish i could use excel

  14. #14
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: More complex lookup formula help (sickness conditions)

    What "value" should i enter?
    It is my english I mean forumula
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    getting warmer, very warm infact.

    Just trying to work out how to copy and paste it into my spreadheet (the one i uploaded was edited due to personal info)

    I fact, can you add anymore coloums. I took a couple out before I posted the spreadheet, if i try and add new coloums on the "data" sheet, no matter where i insert them it mucks up the (impressive!!!!) formula?
    Last edited by burnsie; 03-11-2013 at 11:57 AM.

  16. #16
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    Bump

    Hi all.

    I’m very sorry, lost my train of thought (i completed my tasks last time, but have now been asked to do it again).

    Anyhow, see attached zip from popipipo. I managed to do this but on the original workbook that i have there is just text in the "Condition group" field (its correct), but i have no idea how it got there.

    any help?

  17. #17
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    second bump.

    i think the formula i used last time was something like the below

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    but cant get it to work.

    if anyone is feeling nice....ive attached a sample spreadsheet
    Attached Files Attached Files

  18. #18
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: More complex lookup formula help (sickness conditions)

    Can you please fill some Expected Result in the attachment please...
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  19. #19
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2016
    Posts
    134

    Re: More complex lookup formula help (sickness conditions)

    Quote Originally Posted by Debraj Roy View Post
    Can you please fill some Expected Result in the attachment please...
    like this?

    stats for OT.xls
    got it!

    =VLOOKUP(A10,Sheet2!A:B,2,FALSE) where the answers in sheet two are arranged with col a being the condition and col b being the group
    Last edited by burnsie; 07-18-2013 at 10:21 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1