QUERY Function - Advanced Formulas in Google Sheets, Building Less Error-Prone QUERY Function

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2020
  • Learn how to use advanced techniques in formulas in order to create less error-prone QUERY function statements in Google Sheets.
    #query #advanced #gsuite

ความคิดเห็น • 69

  • @bocobox
    @bocobox 3 ปีที่แล้ว +12

    Inspiring me as usual. Never thought about the difference between array(collection of values) and range(collection of cells).

  • @mohaiminkader6634
    @mohaiminkader6634 3 ปีที่แล้ว +4

    this video deserves 1billion likes and views. So helpful. thanks

  • @DanKulibert
    @DanKulibert 3 ปีที่แล้ว +5

    Great content! I'll sometimes do concat and match on the headers to get the right columns (=QUERY({Data!A1:G},"SELECT Col"&MATCH("Date",Data!A1:1,0)&", Col"&MATCH("Customer/Store",Data!A1:1,0)&", Col"&MATCH("Sales",Data!A1:1,0)&" WHERE Col"&MATCH("Sales",Data!A1:1,0)&" > 8000",1)). Helpful when you can't select the columns individually (e.g. with imports). Your way looks simpler, and better if the headers could change.

  • @IntrepidFox
    @IntrepidFox 3 ปีที่แล้ว +6

    Every single time I learn something new from you. Many thanks!

  • @leonlysak4927
    @leonlysak4927 3 ปีที่แล้ว +14

    Dude I see you're still going strong that's awesome. I remember your AppScript tutorials from 2019 and you've always made your videos very clear and easy to follow along with. Just dropping some love man!

  • @garychadwick1240
    @garychadwick1240 3 ปีที่แล้ว +3

    I never tire of your videos and learn something new every time. Thanks once again.

  • @user-qb8us8ds9b
    @user-qb8us8ds9b หลายเดือนก่อน

    Thanks a lot for this wonderful teaching

  • @mattbrigidi
    @mattbrigidi 3 ปีที่แล้ว +2

    this is a great solution. thanks for sharing it

  • @Shanetoodles
    @Shanetoodles 3 ปีที่แล้ว

    I've written a ton of sheet queries and never thought to do this to get around this problem of queries static references. Thank you!

  • @DanSaleem
    @DanSaleem 3 ปีที่แล้ว

    You are a life saver man. I never get bored watching your videos.

  • @aparamio12
    @aparamio12 3 ปีที่แล้ว +2

    This channel is wonderful! Thanks a lot

  • @Asparuh.Emilov
    @Asparuh.Emilov 3 ปีที่แล้ว +2

    That was amazingly easy fix to some of my time consuming problems. Thanks a lot!

  • @AndrewBennettScience
    @AndrewBennettScience 3 ปีที่แล้ว +1

    Brilliant! This will save me so many headaches. Thank you!

  • @j53iliff2
    @j53iliff2 3 ปีที่แล้ว

    Excellent tutorial

  • @luismiguelumana529
    @luismiguelumana529 3 ปีที่แล้ว +1

    Awesome your vides are always the best ones!!!

  • @bigbrother1211
    @bigbrother1211 3 ปีที่แล้ว +1

    Simply brilliant!

  • @66Komodo
    @66Komodo 3 ปีที่แล้ว +3

    Thank You, very helpful

  • @mdamirhossain9376
    @mdamirhossain9376 3 ปีที่แล้ว

    Awesome, it solves a lot of my problems. Thank you.

  • @user-li7mq5hp9g
    @user-li7mq5hp9g 3 ปีที่แล้ว +2

    Great! Thank you!!!

  • @TaufanPrakoso
    @TaufanPrakoso 3 ปีที่แล้ว +1

    Thanks for make my life easier
    💓

  • @hareesh7053
    @hareesh7053 ปีที่แล้ว

    Makes sense. Better to take some more time in setting the query in such a way rather than spending time later to check how the error popped up.

  • @cric8482
    @cric8482 3 ปีที่แล้ว +1

    Soooo clever !!!. Thanks

  • @jonathanfabian4954
    @jonathanfabian4954 ปีที่แล้ว

    Thanks this is helpfu!

  • @Puner54
    @Puner54 3 ปีที่แล้ว +1

    I like it!!!

  • @indiogigante
    @indiogigante 3 ปีที่แล้ว

    amazing! você é foda, cara!

  • @siddharthjain6629
    @siddharthjain6629 3 ปีที่แล้ว

    I really appeeciate your efforts sir but sir i did not find anything new in the last two videos of query function you have already taught this in your past videos which were amazing. Sir can you please make more videos on apps scripts thats challenging to learn. It is a humble request sir. I appreciate you efforts.

  • @shivendrakumbhkar
    @shivendrakumbhkar 3 ปีที่แล้ว +2

    Hey can you tell me how to add extra column using query function showing from where the data is comming from the sheetname and row like the ROW() funtion you used with filter funtion in combining / making master sheet video

  • @MichaelDaniels
    @MichaelDaniels 3 ปีที่แล้ว +4

    Could I actually add names for those ranges? Like date, store and sales? Would that work?

    • @navigatormoore
      @navigatormoore 3 ปีที่แล้ว +4

      Yes, that will definitely work and preferred. Naming the ranges based on the column header makes it easier to visually index the query range as an array. I.e. QUERY({q_date, q_store, q_sales}, "SELECT Col1, Col2, Col3 WHERE Col3 > 7.00",1) would naturally state the array index as date(named range) = Col1, store(named range) = Col2, and sales(named range) = Col3
      I replicated this same example and gave each column range the names of the headers. The leading "q_" is just my personal naming convention for stating the name is related to using for queries. However, instead of querying the entire range in the array QUERY({Data!A1:G1650}, "SELECT...",1) I called the ranges of concern QUERY({q_date, q_store, q_sales}, "SELECT...",1) E.g. Data!A1:A range is named "q_date", Data!C1:C range is named "q_store", etc. for modular global scope on the ranges to use wherever applicable throughout the workbook including other tabs. I'd even take it a step further and name the range of the entire dataset "Data!A1:G1650" to something I would name a database table like "tbl_customer_sales" so I could reference it in the query range section I.e. QUERY(tbl_customer_sales, "SELECT...", 1)
      I know it's just not me, but it is definitely easier to build functions with named references rather names of the cell location. I also use this method to JOIN related data from other tabs rather than using the arrayformula({vlookup}) method.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว

      Sure.

    • @tomd8019
      @tomd8019 3 ปีที่แล้ว +1

      @@navigatormoore I find it much easier to work with named ranges when using query also, even if just to define the database range. Another nice benefit is that Sheets will autocomplete the range names. I like your "q_" prefix for that reason too, since you can effectively call up all your query column options by typing the prefix. I'm going to start using that too, so thanks for the idea.

  • @poom_laupat
    @poom_laupat 3 ปีที่แล้ว +3

    This is super awesome. Why wouldn't I have known this before. Lol. By the way, i have one topic that might be very interesting to solve. After we have made a super complex Sheet system with dozen of query and Importrange from one sheet to others. Now I have a problem that I can't trace its dependencies of the original data. Now I'm super scared when I have to make some changes on the original set of data. It might causes other file somewhere to get an error like a chain reaction. 🔥🔥🔥

    • @user-un6hx2wq6j
      @user-un6hx2wq6j 3 ปีที่แล้ว +1

      Have the same issue here. Excel has more visibility on data structure between files. Sheets with such functional as deadly weapon in a newbie hands

    • @mattbrigidi
      @mattbrigidi 3 ปีที่แล้ว +3

      i’ve started building data index tabs where I list the name of the tab, it’s purpose, and where the original source data lives.
      To your original point, data hygiene best practices is an important conversation to have

    • @poom_laupat
      @poom_laupat 3 ปีที่แล้ว

      @@mattbrigidi I just started that also but the hard part is that I'm not the only one who touch the main source of data because we run at the company level so sometime it is hard to force everyone to make an update on the index table once they make changes.

  • @Scott-sm9nm
    @Scott-sm9nm 3 ปีที่แล้ว

    That was a brilliant and concise visual explanation. Left me wondering if I can use the convention of no ending row in case more rows are added. Will need to try. i.e. Data!F1:F

  • @putra.m.tampubolon
    @putra.m.tampubolon 2 ปีที่แล้ว

    Magic..

  • @ae_jal_rws
    @ae_jal_rws ปีที่แล้ว

    I have used the formula its kind of worked properly. My source data has been from 3 nos sheets.
    Now the problem is that some cell in query sheet are found blank though there were data in source sheets. your help is highly appreciated. Thank you.

    • @mohitsharma-ym3km
      @mohitsharma-ym3km 4 หลายเดือนก่อน

      Because the data type is inconsistent of that particular column in data set.

  • @RamonSlomp
    @RamonSlomp 3 ปีที่แล้ว

    Very inspiring.
    I have an issue where I can't find the way to do it in Sheets. Can you make a video about this? In short...
    I have a list of names and date of start working.
    Now I want to show, on a different sheet, when I have a jubilee on this month.

  • @singhalmonica
    @singhalmonica 3 ปีที่แล้ว +1

    Sir, u r lessons are so good
    Sir, pls help me for fetching TXT and num value from query fn. I hav both value in single column. Query fn. Fetches NUM value but TXT value not. Pls help me.

  • @josegajardo8451
    @josegajardo8451 3 ปีที่แล้ว

    Incredible! just amazing! This helped me a lot.
    Is there a way to do this within an importrange since I am querying from one spreadsheet to another?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      No, you would need to use a different technique.

    • @josegajardo8451
      @josegajardo8451 3 ปีที่แล้ว

      @@ExcelGoogleSheets omg, so glad you answered, thank you!
      I was thinking doing an import range separatey to all 3 of my sources I am trying to merge and then query them with arrays within my spreadsheet.
      Do you have a better solution for this :o ?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      If you have matching column names, you should be able to search and find the column.

    • @josegajardo8451
      @josegajardo8451 3 ปีที่แล้ว

      @@ExcelGoogleSheets dont know if it helps now but I managed to do it with concat within the arrayformula and a textjoin before the arrayformula all in the same formula.
      Dont know if its too complicated for what I am trying to do but it worked 🤷🏻‍♂️ jajajaja

  • @HelenoPaiva
    @HelenoPaiva ปีที่แล้ว

    Does the first parameter of query HAVE to be in an array in order to reference it as Col1, Col4…. And so on??

  • @lifeprojects1
    @lifeprojects1 3 ปีที่แล้ว

    Now you create a custom formula that maps the headers to the columns position (as range or matrix) and transcribe It to work with the default query formula.... And share with us (: Because i've never been able to work that out. Love all your SS videos btw.

  • @tudosobregestao
    @tudosobregestao 3 ปีที่แล้ว

    Vídeo maravilhoso, mas infelizmente não funcionou para mim. Os intervalos que estão dentro do das { } criaram uma coluna única. O erro "Não foi possível analisar a string de consulta para Função QUERY parâmetro 2: NO_COLUMN: Col2. Fórmula: =Query({Dados!A1:A100;Dados!B1:B100;Dados!C1:C100};"Select Col1, Col2";1). Observação: Aqui no Brasil usamos ";" no lugar da ",". Poderia me ajudar?

  • @AshisAgrawal
    @AshisAgrawal 3 ปีที่แล้ว +1

    How do your sheets respond so fast? No processing time taken! Do you cut the videos?

    • @ConsulthinkProgrammer
      @ConsulthinkProgrammer 3 ปีที่แล้ว

      Nice catch😁

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      I do cut videos, however in this instance it didn't affect the response time. That's how it works when you have fast enough internet connection and a fast enough computer without having too much going on in the spreadsheet.

    • @ConsulthinkProgrammer
      @ConsulthinkProgrammer 3 ปีที่แล้ว

      @@ExcelGoogleSheets even this answer not for my question, but it was long time not seen your personal anwer like this appear in my notification pop up. I think I little miss it :)

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      @@ConsulthinkProgrammer I try to always answer comments as time allows.

    • @ConsulthinkProgrammer
      @ConsulthinkProgrammer 3 ปีที่แล้ว

      @@ExcelGoogleSheets Thanks a lot Sir. I learn so much from you. I use it in my work and documenting it in my channel, to record what i've learn (almost) from you and some from other youtube channel :)

  • @H-do8tr
    @H-do8tr 10 หลายเดือนก่อน

    How to filter results by two dates?

  • @tiffanysimborio7448
    @tiffanysimborio7448 3 ปีที่แล้ว

    Hmmm... interesting...what if I lock the range?..hmm.. let me try..

  • @Scott-sm9nm
    @Scott-sm9nm 3 ปีที่แล้ว

    Tip on identifying errors in your SQL statement when it gives you a offset to the error within the SQL statement. New vid material? Example - i.imgur.com/x8Ua6VK.jpg

  • @MrAbaeterno
    @MrAbaeterno 3 ปีที่แล้ว

    I use GSheets at work and this channel is so very helpful. I struggle with the formulas and this is my go to for answers.
    I am looking for help with a problem i have from the subscibers.
    Query Vs Vlookup
    I replicated a problem i had in this spreadsheet: updated
    docs.google.com/spreadsheets/d/1ROiZhKaEbjZMBjs0pA1Jg1vt3nQyNsptz2_tznykpPs/edit?usp=sharing
    The original sheets are separate sheets. I used importrange to get the data from one spreadsheet to another.
    I only want data from one colum to be imported into another spreadsheet based on the info in two column in a second spreadsheet.
    I managed to do what I needed but i do not understand why query didnt work.
    Also. I have one problem with a row that has a persons double surname.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      You forgot to make it public.

    • @MrAbaeterno
      @MrAbaeterno 3 ปีที่แล้ว

      @@ExcelGoogleSheets
      docs.google.com/spreadsheets/d/1ROiZhKaEbjZMBjs0pA1Jg1vt3nQyNsptz2_tznykpPs/edit?usp=sharing

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      OK, so the reason you are having these issues is because on your Sheet1 names in the first column have an extra space after the last name.

    • @MrAbaeterno
      @MrAbaeterno 3 ปีที่แล้ว

      @@ExcelGoogleSheets thx. i would not have even thought of looking there.