+ Reply to Thread
Results 1 to 21 of 21

New Excel Formula needed using IF to populate cells if "*" is added to a column

  1. #1
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    New Excel Formula needed using IF to populate cells if "*" is added to a column

    Hi All,

    I was wondering if anyone can help me. I have 2 tabs on a workbook INPUT and UK. I am looking to build a formula to insert data on the UK sheet if * is entered on column Q from the INPUT tab. Basically:-


    COLUMNS

    L (Amount) M(Rate) N(Inv) O(Descrip) P(Reason) Q(*)

    3,200.09 I 0.200 Ven.Inv. automatic T AP, GRIR 1
    12.28 I 0.200 Ven.Inv. automatic T AP, GRIR 1 For IT *
    1,631.82 I 0.200 Ven.Inv. automatic T AP, GRIR 1 For BE *
    6,426.14 I 0.200 Ven.Inv. automatic T AP, GRIR 1

    The above data is on the INPUT tab and on the UK tab:

    I would like the same data to populate below if * is added to a row in the INPUT tab

    COLUMNS
    (L) (O) (M)


    Many Thanks in advance for any input

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Please can you post a small sample file.

  3. #3
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Hi, Please see file attached:

    The UK tab needs populating automatically when the * is added so that you don't have to manually add it, these are only 2 , but there are sometimes 100's of lines to add..


    Thanks very much..
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Enter in A6

    =IFERROR(INDEX(Input!$J$3:$J$100,SMALL(IF(Input!$O$3:$O$100="*",ROW($A$3:$A$100)-ROW($A$3)+1,""),ROWS($A$3:A3))),"")

    Enter with Ctrl+Shift+Enter

    Copy across and change range in RED to appropriate range in input

    Copy down.

  5. #5
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    HI, thanks very much, you are a genius, however what if I need to change the * to @ , i've tried it and it doesnt work...

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    @ has a special meaning (reserved character) in Excel so can not be used.

  7. #7
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    I got it was the ctrl+shift +enter that i forgot --- THANKS SO MUCH ---- EXCELLENT FORMULA!!!!!!!!

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Glad it is OK. Could you please mark thread as SOLVED ("Thread tools" at top of first post). Thank you.

  9. #9
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Thanks again... Can you explain the formula, so that i know how to customise it, eg if I need to insert another condition (if column with Doc type is RE, KR and KA, then do the above formula, but if not still do formula but paste below.

    Why do we use SMALL and IF together and why are doing the -ROW($A$3)+1,""),ROWS($A$3:A3) --- just so I can understand and use in other sheets if I have to as I think this is a brilliant formula....

    Many Thanks

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    How this works ...

    =IFERROR(INDEX(Input!$J$3:$J$100,SMALL(IF(Input!$O$3:$O$100="*",ROW($A$3:$A$100)-ROW($A$3)+1,""),ROWS($A$3:A3))),"")

    It is an "array formula" and as the name suggests Excel stores an array of results.

    The IF statement simply tests the criterion for selection: if it is TRUE, it stores the row number (that 's the ROW($A$A$100)-ROW($A$3)+1) and if FALSE it is blank so we end up with an array like 1,2," "," ",5," " etc. So rows 1,2 and 5 match, 3,4 do not.

    Using SMALL with the ROWS($A$3:A3) as the k smallest value (so this goes 1,2 3 as we drag the formula down) we select row 1,2,5 etc from the INDEX range. note that row is relative to the start of the selected range so row=1 is J3 in this example

    You can see this if you click on a cell containing the formula then click on SMALL in the formula bar then "fx".

    You cannot put more than one formula in the same column.

    If you need to extend your selections (as it appears to be multiple choice) , re-post.

    If you simply need to extended it to include another column with same selection criterion ("*") then just change the J range to whatever.

    Hope this helps.

  11. #11
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Thanks very much,

    Why are we subtracting this then adding +1 on the below


    -ROW($A$3)+1

    Thanks very much for your explanation, very thorough indeed.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Just a technique to ensure we always start at 1: the ROW( .....+1 is a "standard" approach using INDEX/SMALL formulae. Note that is advised to keep the ranges consistent as well as we much less likely to get errors.

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Quote Originally Posted by pidnani View Post
    Why are we subtracting this then adding +1 on the below

    -ROW($A$3)+1
    If you index the entire column then you don't need to do that:

    =IFERROR(INDEX(Input!$J:$J,SMALL(IF(Input!$O$3:$O$100="*",ROW(Input!$O$3:$O$100)),ROWS($A$3:A3))),"")

    Still array entered.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    I was just thinking about adding a comment about Tony and his knowledge of Excel.

    His reply here is typical of what he (in particular) brings to this forum: little pearls of wisdom to help us all use Excel more effectively and efficiently.

    So (again) I have just learned something new!

  15. #15
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Thanks very much Tony and John for your excellent expertise.. I have a change in the scenario in the same formula. I have added another tab called output and so I would need it to do the exact same thing in the formula above, but also conditioning Output!, so I need the formula to look in to 2 sheets instead of just the one input! see attached.


    Thanks very much..

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Try this

    =IF(COUNTA($A$3:$A3)<=COUNTIF(Input!$O$3:$O$100,"@"),IFERROR(INDEX(Input!$J$3:$J$100,SMALL(IF(Input!$O$3:$O$100="@",ROW($A$3:$A$100)-ROW($A$3)+1,""),ROWS($A$3:$A3))),""),IFERROR(INDEX(Output!$J$3:$J$100,SMALL(IF(Output!$O$3:$O$100="@",ROW($A$3:$A$100)-ROW($A$3)+1,""),ROWS(INDIRECT("$A$3:$A"& ROW()-COUNTIF(Input!$O$3:$O$100,"@")-1)))),""))

    As usual, enter with Ctrl+Shift+Enter

    Sample in attached.

  17. #17
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Thanks John, brilliant, only last thing is what if I need the data populated under a another subtitle on the same sheet called Non WNS , so if Output tab has "@" to put the data under non-WNS and if input then past on top as normal above formula under WNS (See highlight in green (see attached).

    Thanks very much once again..

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Why did you not state this initially as I could simple have copied the separate formulas rather than try and combine them. The issue you will have is if the WNS list is greater than the rows allowed. The simplest answer would be to have 2 tabs. why make life complicated?

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,284

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    See the attached.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Thumbs up Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Thanks very much John,,, makes complete sense, don't know why I didn't think of that

    Thanks so much for all your help...Brilliant formulas!

  21. #21
    Registered User
    Join Date
    01-15-2015
    Location
    London
    MS-Off Ver
    7
    Posts
    32

    Re: New Excel Formula needed using IF to populate cells if "*" is added to a column

    Hi John,

    Another interesting crop has come up, using the same formula with ISNUMBER and SEARCH--- as what i want it to do is if the input tab in the Comment column if it has the words "Reversal or Payment", I want to use the same formula but copy it at the bottom. I',m not worries about the list being greater as it is normally only 2 or 3 lines...

    Thanks for any suggestion to this

+ 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. [SOLVED] if formula needed to populate either "1" or "0" based on number of units in another cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-07-2015, 11:24 AM
  2. [SOLVED] Formula or function to populate a range of cells based on "TODAY()"?
    By Bonzopookie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2014, 05:59 PM
  3. Replies: 1
    Last Post: 02-04-2014, 08:43 PM
  4. [SOLVED] Formula Needed to fill multiple cells with "No" when the word "No" is entered into a cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2013, 05:36 PM
  5. [SOLVED] Formula needed to display "Pass" or "Fail" if a column contains any values other than "yes
    By andreindy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2013, 05:49 PM
  6. Delete Row if Cells in specifc Column Equals "X" Macro Needed
    By Ivanur55 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2012, 02:23 PM
  7. Help Needed to get Filters Using "Include" and "Exclude" multiple values on one column.
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2012, 04:03 AM

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