+ Reply to Thread
Results 1 to 10 of 10

Query function to distinguish a column to different column

  1. #1
    Registered User
    Join Date
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8

    Query function to distinguish a column to different column

    Good day,

    I have this raw data and want to use one query function to produce the expected result.
    Now I am using 3 different formulas to produce it and I would like to use just one query formula.

    Query.png

    docs.google.com/spreadsheets/d/12506dX7TMpgdwLz0x2hlQFTeTdilR6VUCAXvTf5eM8M/edit#gid=0

    (I don't know why I cannot post the link)
    Last edited by AliGW; 08-16-2021 at 02:08 AM.

  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,780

    Re: Query function to distinguish a column to different column

    You have fewer than 10 posts here, so are not allowed to post links, so I have converted your text to a link for you.
    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
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Query function to distinguish a column to different column

    I won't follow your link, but going from the screenshot you can try this formula in J3:

    =SUMIFS(E:E,A:A,G3)

    Copy down as required.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8
    Quote Originally Posted by Pete_UK View Post
    I won't follow your link, but going from the screenshot you can try this formula in J3:

    =SUMIFS(E:E,A:A,G3)

    Copy down as required.

    Hope this helps.

    Pete
    Thank you. But not of help at all
    I would like to have the whole table using only one formula


    From G2 to J4 I am using a query formula

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Query function to distinguish a column to different column

    Okay, thanks for the feedback - good luck with that.

    Pete

  6. #6
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Query function to distinguish a column to different column

    So, do you a need a unique formula only for Columns K and L ?

    If so; clear the range K2:L3 in your sheet and you can use the following formula in cell K2, which will return the results in cells K3 and L4.

    Please Login or Register  to view this content.
    Last edited by Haluk; 08-17-2021 at 01:52 PM.

  7. #7
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Query function to distinguish a column to different column

    Also; if you want to produce the whole table in range G2:L3 with only a single formula, clear the cells G2:L3 in your sheet and enter this formula in cell G2 :

    Please Login or Register  to view this content.
    Attached Images Attached Images

  8. #8
    Registered User
    Join Date
    07-13-2021
    Location
    Hong Kong
    MS-Off Ver
    365
    Posts
    8

    Re: Query function to distinguish a column to different column

    Quote Originally Posted by Haluk View Post
    Also; if you want to produce the whole table in range G2:L3 with only a single formula, clear the cells G2:L3 in your sheet and enter this formula in cell G2 :

    Please Login or Register  to view this content.
    Thank you. So there are three query in the cruel blanket like this? {query A,query B, query C}
    What is the usage of the curly brackets?
    Last edited by Bobbie Kan; 08-17-2021 at 11:29 PM.

  9. #9
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Query function to distinguish a column to different column

    the {curly brackets} treats the 3 queries as an array, otherwise the formula will not work... you did say in opening post that it must a single formula, so this is necessary.

    also note that when using this particular formula, for each invoice there must be a "Fee" AND at least one type of "Outlay". if the source data only has a Fee OR an Outlay then the result will be an #REF! error.

  10. #10
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Query function to distinguish a column to different column

    As mentioned by janmorris in his message; you need to have at least 1 data either blank or zero for a FEE and OUTLAY item, although it may not exist in reality.... as seen below;
    Attached Images Attached Images

+ 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. Distinguish data from one column to another
    By Bobbie Kan in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-17-2021, 11:19 PM
  2. [SOLVED] Need a Function to Distinguish Between Multiple Criteria
    By Proj_Eng in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-17-2020, 12:48 PM
  3. [SOLVED] Move column after another column with Power Query
    By lofgren in forum Excel General
    Replies: 2
    Last Post: 07-03-2020, 06:04 AM
  4. Query column of PC names to retrieve remote mac addresses in another column
    By CME1212 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2016, 04:48 PM
  5. Google Sheets Query IF column problem Converted to Excel Function?
    By Garthilk in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-24-2015, 10:37 PM
  6. [SOLVED] Distinguish whether the next cell down is <20 OR a word in a different column is present..
    By tlacloche in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-25-2013, 01:25 PM
  7. Replies: 3
    Last Post: 05-22-2013, 01:08 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