+ Reply to Thread
Results 1 to 10 of 10

Help with excel - Possible IF function?

  1. #1
    Registered User
    Join Date
    09-07-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Help with excel - Possible IF function?

    Hi all,

    I hope you guys can help me solve this and/or point me in the right direction.

    I have an excel workbook, please see attached. Sheet 1 of that excel workbook, called 'Master', contains email addresses on Column A2:A15 (fake emails I made up for this sake of showing you guys this problem I am having on a spreadsheet at work).

    On the second worksheet, titled 'Clicks' there are four populated columns. Each column has a three digit "ID" at the top. Think of each ID as being the heading (source, actually) for all the information in its column. For example, “ID” 123 in A1 is a heading for all the information from A3:A16.

    In column B2 of the 'Master' worksheet, I have added a COUNTIF function that shows how many times the value in A2 occurs in the Clicks worksheet, regardless of where the information actually is from. I just needed a count. So you can see that cell B2 (of Masters worksheet) displays 3 because there are three occurrences of the email ‘[email protected]’ on the Click worksheet.

    This is where I have the problem. On cell C2 of the Master worksheet I need to add a formula that will search through the entire information on the 'Clicks' worksheet and if it finds any data matching the data in A2, then I want it to show the ID in cell C2. If there is more than one instance of a given email address, then it would display those IDs in the same cell (C2), separated by a space. For example, [email protected] would generate the following in cell C2: 123 456 1011.

    If anyone is now not having seizures after reading the above, please advise / solve this for me.

    Thank you in advance, any questions please do not hesitate.

    Dumbluck.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Help with excel - Possible IF function?

    Something like this then? I can do it without the helper columns as well but that requires VBA.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is an array formula, it has to be entered with Ctrl + Shift + Enter.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    09-07-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Help with excel - Possible IF function?

    Thank you very much.

    I do need it done one one column, so without the helper columns. I think the arrangement of the second sheet is not very helpful for anyone as it makes things completed and long-winded. I am not familiar with VBA. Is it a single string of code which u alter to?

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Help with excel - Possible IF function?

    I found some old code that I modified and recycled, so here is the UDF version.
    Please Login or Register  to view this content.
    Edit: Small error http://www.excelforum.com/excel-form...ml#post4184061
    Attached Files Attached Files
    Last edited by Jacc; 09-08-2015 at 06:49 AM.

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Help with excel - Possible IF function?

    VBA is a sort of programming language (macro language) that is included in Excel. It can be made to run in the background triggered by buttons or events.
    It is also possible to use VBA to write your own custom functions that works just like any other function that you put in a cell. This is called a UDF (User Defined Function).

  6. #6
    Registered User
    Join Date
    09-07-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Help with excel - Possible IF function?

    Oh wow it's actually done! Thank you so much Jacc.

    I must be honest though; this is way beyond what I can comprehend on Excel. (VlookUP and Pivot tables are as advanced as I go) and I had no idea my problem needed coding, not once. Thank you for the short introduction on excel coding.

    At work, My manager and I are on a short project.

    I believe I made the mistake of making such a poor 'Clicks' sheet. If fact, the Clicks sheet did not exist at first.

    This is the original problem (I hope its not too exhausting). We have a Master workbook, that contains 20,000 emails addresses in Column A (A1:A20000). We also have 20 non-master excel files that contain the same 20,000 email addresses but between them. For example, non-master Workbook 1 has maybe 5,000 emails through Column A (A1:A5000), non-master Workbook 2 has maybe 2,000 emails through Column A (A1:A2000) etc. It all adds to 20,000 emails in the end between the 20 non-master excel workbooks.

    These "IDs" I mentioned are actually unique file names given to every non-master excel workbook. For example, non-master Workbook 1 may have a file name that looks like this: 000001 (not true, just an example). These file-names are very important to us.

    I can’t go in-depth as to why we are doing this but in the Master workbook we have 20,000 rows of emails in column A and we just wanted to write in the “ID” next to each email so we know which non-master file contained that unique email address. For example, if [email protected] is in the excel file called ‘000001’ then ‘000001’ will be in B1 next to '[email protected]' which will already be in A1 (of the Master workbook that is).

    Also, these 20 non-master files can't be altered, this includes their file name.

    We can complete this project if we drink enough coffee and miss xmas, but we thought there would be a faster way and also a way we could comprehend.

    So genius me thought to create a new sheet called Clicks, paste each of the 20 file names in row 1 of every column A-T and then paste each data from each non-master file below it’s filename. And from there just try our luck.

    I will try to brainstorm and find a better first approach but I truly thank you for trying and achieving what we have tried to complete for the past day.
    Last edited by dumbluck; 09-07-2015 at 06:48 PM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Help with excel - Possible IF function?

    Another way formula wise. If you have 4 columns / IDs in the clicks sheet this array-entered (Ctrl + Shift + Enter) formula in C2 of Master filled down works at my end.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you have more than 4 columns you can expand this, but it will become cumbersome beyond 6 or so.

    Does this help?
    Attached Files Attached Files
    Dave

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Help with excel - Possible IF function?

    I don't think you can get around the problem by changing the layout of the data. UDF's may be a little scary in the beginning but maybe this article will help: http://www.cpearson.com/excel/writin...ionsinvba.aspx
    It's a matter of having my file and your file open at the same time and then drag and drop the module containing the code over to your workbook. Hit Alt + F11 to get to the VBA editor.
    Once the code moduled is copied the UDF function is available, just type LookupConcatX4 into a cell.

    If you don't mind putting together a rather long formula then FlameRetired's solution should work just fine.

  9. #9
    Registered User
    Join Date
    09-07-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Help with excel - Possible IF function?

    Hi FlameRetired,

    Yes this does help and I will discuss this with my manager today.

    Jacc - I would like to learn this. Thank you for the link, I shall have a look at it.


    Dumbluck.

  10. #10
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Help with excel - Possible IF function?

    I found a small error; where it says xlByRows it should say xlByColumns. The difference is that with xlByColumns the headers are listed in the correct order.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 04-24-2014, 11:56 AM
  2. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  3. Replies: 1
    Last Post: 03-21-2012, 11:22 AM
  4. Replies: 2
    Last Post: 03-30-2009, 04:04 AM
  5. New Function in Excel 2007 - IFERROR Function
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 11-15-2007, 05:09 AM
  6. Javascript function converting to Excel function
    By kamila in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-31-2007, 07:06 AM
  7. [SOLVED] Excel - User Defined Function Error: This function takes no argume
    By BruceInCalgary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2006, 04:05 PM

Tags for this Thread

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