+ Reply to Thread
Results 1 to 8 of 8

Merge/Concate with IF's? Or am i overthinking this?

  1. #1
    Registered User
    Join Date
    05-19-2021
    Location
    Oregon, United States
    MS-Off Ver
    Excel for 365
    Posts
    4

    Merge/Concate with IF's? Or am i overthinking this?

    Because of awkward and uncontrollable online formatting, I have data that has to be copy and pasted into a workbook. It (often but not always- see the case of "donation") compresses two data fields that should rightfully be split into neighboring cells (for example B2, C2) into ascending cells in the same column (for example, B2 C2).

    Unless I am overthinking everything, I need the 'description' (the 'Processing fee' or 'Credit') to be in the same row as their corresponding item/transaction number. ('the xxx-yyyyyyyyyyy')

    I've thought to try nested concate or jointext with Lookup Search for the paramaters of "XXX", "Fee" and "Credit", but i can't find the right formula to work.

    Who's got the solution?

    Many thanks!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Merge/Concate with IF's? Or am i overthinking this?

    Hi,



    This is probably a much simplified example and probably doesn't represent the size or layout of your actual data. We often find that when we give an answer to what is a trivial non representative example when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned.

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see. Clearly identify which is original data and which are the results and in a note clearly explain how you have arrived at your results.

    For instance are the New Items always starting with XXX, and where does XXX-0032573150 come from?
    The first four Text descriptors are on alternating lines, but then the fifth is three rows away from the fourth one. We're always looking to understand the layouts and where they may vary.

    Remember that when you ask a question in a forum those of us who might be able to help know absolutely nothing about your system and work process or the terminology you use. Unless you have uploaded a workbook we know nothing about how it is laid out and little about what you want done with it or how the results should be presented.

    Whilst these things are second nature to you since you live with the workbook all the working day we start with zero knowledge so you need to take us by the hand and explain in quite precise detail your aims and goals as well as stuff like how your data might look different in other situations.
    Don't assume we are able to "figure it out". We're usually quite good but not prescient.

    Put yourself in our position and think about whether what you've posted makes sense and is unambiguous to someone who's never seen it before.
    You are asking us for help so help us to be able to help you by providing all the information we need, even if that information seems obvious or intuitive to you.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-19-2021
    Location
    Oregon, United States
    MS-Off Ver
    Excel for 365
    Posts
    4

    Re: Merge/Concate with IF's? Or am i overthinking this?

    Thanks for your input Richard. I'll upload a new workbook with additional commentary/context and try again!

  4. #4
    Registered User
    Join Date
    05-19-2021
    Location
    Oregon, United States
    MS-Off Ver
    Excel for 365
    Posts
    4

    Re: Merge/Concate with IF's? Or am i overthinking this?

    Hopefully this is more helpful:

    I have a set of data that I, unfortunately, have to regularly copy and paste from an online source. It produces 20 rows and 5 columns of data, as you might see with the first two rows mysteriously offset into an extra column. (seen as column A or a "bonus/work column")

    While some values are rather straight forward: date, values, and ending balance, some are not. The formatting of the data, for some reason, pastes the "description" and the "code" into neighboring cells of the SAME COLUMN, as opposed to, as i'd think it convenient, neighboring cells of the SAME ROW.
    By this you might see in the "original":
    G5: Bag Credit
    G6: FUN-0032573152
    I'd think it sensible for the item description and code to be in neighboring cells of the same row, or even in the same cell altogether. (if need be)
    G3 H3 G3
    Bag Processing Fee FUN-0032573152 or even Bag Processing Fee FUN-0032573152


    There are some transactions in which this does not occur. For example, in which the description is one line only because the transaction is a 'donation'. This has threw off some of my previous attempts of formulas that were odd/even row-based formulas.


    I've uploaded a longer version of the original file, and shown an example of what an "end version" i am hoping to see. However, that end version is only produced by manual copy-paste's, as my attempts at, for example, conditional lookups based on a search of "fee" or "credit", have all failed.

    Would appreciate someone's fresh perspective, as I think I've been well overthinking this, OR, entirely missing a mark!
    Thanks!
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    05-03-2021
    Location
    Nashville
    MS-Off Ver
    MS Office 365
    Posts
    184

    Re: Merge/Concate with IF's? Or am i overthinking this?

    So I do this for work all the time.
    I get Text files that are in all sorts of weird order.
    I find a common denominator and then when I copy and paste the data into a "Filter"

    I then organize what I want to go into each column and what isn't allowed.

    In your case Column "A" could only allow strings of text that have the word "Bag" or "Online" or "Donation" found and all other cells would be ignored.
    Then since the "Code" always has a "-" in it, That was easy to parse out.

    The numeric columns were harder. Excel understands dates as values 1 to "infinite" 1 being 1/1/1900 and 1/1/1901 being 366 etc.

    So I picked 42000 as a good round number to separate what is monetary and what is a date.. Less than that number it is probably money, greater than that
    number it is probably a date.

    I then created a table lookup based on index match and removed the spaces.


    This is slow, as it is very volatile (lots of calculating formulas) but it is faster than sifting through unorganized data.

    If someone can do better and finds a faster way to organize the raw data, it won't hurt my feelings and I will likely learn something.
    That said, Here is what I came up with.
    Attached Files Attached Files

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Merge/Concate with IF's? Or am i overthinking this?

    Here's one way - a macro would be another

    The first record is an exception to the general layout hence I've added in an IF... function to compensate. YOU could remove this if you prefer and use the general formula for rows 4 onwards and manually add the first row values.

    I've put index numbers in G1:K1. You could also replace references to these in general function with those numbers.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-19-2021
    Location
    Oregon, United States
    MS-Off Ver
    Excel for 365
    Posts
    4

    Re: Merge/Concate with IF's? Or am i overthinking this?

    TheNewkidd, great help. I wouldn't have thought of that supporting table. And Richard, your formula was nearer to what I had in mind, (albeit much cleaner) but couldn't spit out in any rendition. Many thanks.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Merge/Concate with IF's? Or am i overthinking this?

    Quote Originally Posted by almostaking27 View Post
    TheNewkidd, great help. I wouldn't have thought of that supporting table. And Richard, your formula was nearer to what I had in mind, (albeit much cleaner) but couldn't spit out in any rendition. Many thanks.
    I don't understand. Clearly the workbook I attached performs the task. Are you indicating that the production workbook is laid out differently, i.e. not in A1:E..whatever?

    If so please note that the formula on row 3 in G3 is =INDEX(IF(A4<>"",$A:$A,$B:$B),INT(ROW()*2+2)-G$1,1) and contains the formula

    INT(ROW()*2+2)-G$1

    This uses the ROW() function, and since it's on row 3 it returns the value 3. This is then multiplied by 2, i.e. 6, then 2 is added, i.e. 8 and finally the G1 value of 5 is deducted which results in the value 3

    This formula when copied down to succeeding rows returns values 5,7,9,11,....etc. and is the source for the INDEX row function.

    If your data does not start in row 3 then you will need to adjust the INT(ROW()*2+2)-G$1 formula such that it returns the number of the row that contains the formula.

    I also make the assumption that your data does alternate by two rows each time for each occurrence of the Bag and FUN references.

+ 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: 13
    Last Post: 01-14-2016, 04:19 PM
  2. Overthinking hyperlink?
    By Javajawa16 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2013, 06:30 PM
  3. Using concate and vlookup in one cell
    By AnViL123 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-04-2013, 07:27 AM
  4. =Concate
    By marshahannah in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2013, 07:46 AM
  5. concate function not working
    By jolinchew in forum Excel General
    Replies: 1
    Last Post: 05-18-2012, 03:55 AM
  6. Concate help!
    By Voryn in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-01-2009, 11:15 AM
  7. Cells concate rpoblem
    By keleistein in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2007, 04:17 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