+ Reply to Thread
Results 1 to 9 of 9

Display a code based on if there is value in a field

  1. #1
    Registered User
    Join Date
    08-30-2021
    Location
    London, England
    MS-Off Ver
    Office 2019
    Posts
    12

    Display a code based on if there is value in a field

    Hi all,

    I am working on a delivery log spreadsheet which tracks deliveries and types of delays. There are multiple types of delay, for example unloading, paperwork, etc, and these are displayed in time. If there is any value in one of these fields I need the "code" column to display the corresponding code. For example, if there is a 10 min unloading delay, I need the code column beside that corresponding delivery to display "U" or if there is a 45 minute paperwork delay, I need the code "P". The time is irrelevant and typically there aren't more than 1 type of delay in the same delivery.

    Sorry if this has been asked before, I am not sure what this is called. I have done some searching but couldn't find anything related.

    Thanks for any help!

    EDIT: the example workbook just has the basic fields, and I populated the code column based on how I would like it to look. but I am looking for a solution/formula to automatically populate the code field.
    Attached Files Attached Files
    Last edited by AliGW; 08-30-2021 at 04:28 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,974

    Re: Display a code based on if there is value in a field

    Welcome to the forum.

    2103 is merely a release number for MS365, which is the version you need in your profile, please.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-30-2021
    Location
    London, England
    MS-Off Ver
    Office 2019
    Posts
    12

    Re: Display a code based on if there is value in a field

    Apologies, updated and added an example attachment to OP.
    Last edited by AliGW; 08-30-2021 at 10:25 AM. Reason: PLEASE don't quote unnecessarily!

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,081

    Re: Display a code based on if there is value in a field

    Hi & welcome to the board.
    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,974

    Re: Display a code based on if there is value in a field

    In F3 copied down:

    =LEFT(INDEX($C$2:$E$2,MATCH(1,$C3:$E3,1)),1)

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,441

    Re: Display a code based on if there is value in a field

    Cell F3 formula , Drag down

    HTML Code: 

  7. #7
    Registered User
    Join Date
    08-30-2021
    Location
    London, England
    MS-Off Ver
    Office 2019
    Posts
    12

    Re: Display a code based on if there is value in a field

    works great, thank you so much!

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,081

    Re: [SOLVED] Display a code based on if there is value in a field

    Glad to help & thanks for the feedback.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,974

    Re: Display a code based on if there is value in a field

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. How to write code to delete record based on field value?
    By VAer in forum Access Tables & Databases
    Replies: 5
    Last Post: 12-29-2020, 09:08 AM
  2. [SOLVED] VBA code to auto update a field based on 2 fields
    By prabhu04 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2020, 11:04 AM
  3. Conditional Formatting to color-code 1 cell based on data in another field
    By Rhesa324 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2019, 12:33 AM
  4. [SOLVED] Code to display text & code in a combo list, but display only code when selected
    By kdestef1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2019, 06:07 PM
  5. Replies: 3
    Last Post: 08-22-2018, 06:42 PM
  6. Formula to autofill a field based on a code
    By AndyRehn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2018, 08:31 AM
  7. Replies: 0
    Last Post: 06-26-2012, 09:06 PM

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