+ Reply to Thread
Results 1 to 13 of 13

function to auto-populate a cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    function to auto-populate a cell?

    Hi all!
    I like to think I'm a pretty savvy excel user, but when it comes to functions I'm definitely the most inferior.

    I have a spreadsheet I use to automate soap recipes. I would like a cell to return a value based on what I type in a cell beside it (well, a couple over to be exact). the value it would return would be based on another sheet within the book.

    what I do right now is type in the oil I'm using (eg olive), how much of it, the SAP value of the oil, and then it calculates how much sodium hydroxide I need (using very basic formulas of F3=D3*B3). I have all the SAP values entered on another sheet at the back of the workbook so I just flip over and enter it in the appropriate cell (D3), but in my dream world when I type "olive oil" in A3, D3 will magically produce "0.134". "0.134" being the SAP value that I presently enter manually after looking it up on the sheet at the back.
    is there any way to automate this? I started looking at IF functions, but I can't figure out how to get it past 2 arguments, and it seems like a LOT of typing since I'm using text instead of a number that could be greater than or less than.

    if someone could offer some help I would greatly appreciate it! even if you can tell me which function would be appropriate I can find some tutorials I'm sure.

    Thanks very much!
    Bianca
    Attached Files Attached Files
    Last edited by lincolnelectra; 07-20-2013 at 06:51 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,544

    Re: functions make my brain hurt, please help!

    Hi Bianca,

    You will, very likely, be asked to change your thread title because it breaches forum rules.

    Please do that. In the meantime, have a look at VLOOKUP. Should be exactly what you want.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: functions make my brain hurt, please help!

    Bah first post and I'm already making mistakes!
    My apologies!

    Thanks very much for the suggestion, I will check that out!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: functions make my brain hurt, please help!

    Hi and welcome to the forum

    Yes, sorry but Trevor is correct

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: functions make my brain hurt, please help!

    Bianca,

    See attached. Check out Jay's olive oil soap sheet (3-3070). Click on either of the two oils, and the drop down button that appears to the right (this is called Data Validation with in-cell drop-down list, though the button technically is outside the cell ). As a demonstration change oil, and then change back.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: functions make my brain hurt, please help!

    I know I responded to this, but evidently my phone didn't complete the transaction.

    jhren! you = magic! thank you so much!!! what wizardry created this magical spreadsheet? please teach me your secrets!

    Quote Originally Posted by jhren View Post
    Bianca,

    See attached. Check out Jay's olive oil soap sheet (3-3070). Click on either of the two oils, and the drop down button that appears to the right (this is called Data Validation with in-cell drop-down list, though the button technically is outside the cell ). As a demonstration change oil, and then change back.

  7. #7
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: functions make my brain hurt, please help!

    Quote Originally Posted by lincolnelectra View Post
    ...
    jhren! you = magic! thank you so much!!! what wizardry created this magical spreadsheet? please teach me your secrets!
    Your quite welcome! ...but no magic involved ...and no secret either

    What I did was make use of Data Validation coupled with named range and VLOOKUP techniques. There's plenty of info already on the 'net regarding these topics...

  8. #8
    Registered User
    Join Date
    07-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: function to auto-populate a cell?

    awesome! thanks very very much to you both (jhren and TMShucks) now that I know what to look for, find it I will!

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,544

    Re: function to auto-populate a cell?

    jhren has used a Named Range for the VLOOKUP.

    In its simplest form, the formula in D3 would look like: =VLOOKUP(A3,SAPs!$A:$B,2,FALSE)

    To take jhren's Named Ranges one stage further, you could have a Dynamic Named Range. Then you can add entries to the table and not need to change the range definition.

    Define oil as:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$A:$A,COUNTA(SAPs!$A:$A))

    and oil_n_SAP as:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$B:$B,COUNTA(SAPs!$A:$A))


    Or, better, add headers and convert the list to a table. That gives you the capability to sort and filter the list.

    If you add headers, the Dynamic Named Ranges would become:

    oil:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$A:$A,COUNTA(SAPs!$A:$A))

    oil_n_SAP:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$B:$B,COUNTA(SAPs!$A:$A))



    See the updated workbook.



    Regards, TMS
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: function to auto-populate a cell?

    Quote Originally Posted by TMShucks View Post
    ...

    Or, better, add headers and convert the list to a table. That gives you the capability to sort and filter the list.

    If you add headers, the Dynamic Named Ranges would become:

    oil:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$A:$A,COUNTA(SAPs!$A:$A))

    oil_n_SAP:
    Formula: copy to clipboard
    =SAPs!$A$1:INDEX(SAPs!$B:$B,COUNTA(SAPs!$A:$A))



    ...
    If headers are added and 2D range is converted to a Table, you can use structured references in the respective Named Range formulas.

    Using your revised workbook...

    oil: =Table1[Oil]
    oil_n_SAP: =Table1

    This would also make the named ranges dynamic... as long as any modification to the list is within the bounds of the Table.

    Actually, oil_n_SAP named range could be deleted , and simply use "Table1" in the VLOOKUP formulas... and "Table1" could be renamed to something more indicative of its contents.
    Last edited by jhren; 07-22-2013 at 06:32 PM.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,544

    Re: function to auto-populate a cell?

    @jhren: good thought.

    You could actually ditch the Dynamic Named Ranges and use the Table entries directly.

    Regards, TMS

  12. #12
    Registered User
    Join Date
    07-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: function to auto-populate a cell?

    sweet!
    you guys rock!! thanks again!

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,544

    Re: function to auto-populate a cell?

    Thank you.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. best Formula to caculate a wage threshold
    By agalinauskas in forum Excel General
    Replies: 1
    Last Post: 07-05-2012, 03:19 PM
  2. Trying to make one cell do two functions
    By jeftex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2011, 02:22 PM
  3. Please don't hurt me, I'm a looping noob!
    By jw191 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2007, 05:10 AM
  4. Brain Dead
    By CBrausa in forum Excel General
    Replies: 3
    Last Post: 08-16-2006, 09:50 AM
  5. Brain Dead: Need help with ????
    By WarrenC in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-25-2006, 03:15 AM

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