A formula to group timeslots? [closed] - google-sheets

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a column in my Google Sheet that shows timeslots for appointments in the following format:
07:15-07:45
09:00-09:30
12:45-13:15
16:30-17:00
In a new column, I would like to condense these into groups so that for instance any timeslot between 07:00-10:00 would be "Early Morning" 10:00-13:00 would be "Late Morning/Early Afternoon" etc.
How would I be able to do this with a formula?

Please try the following
=ArrayFormula(IFERROR(IFS(
IFERROR(REGEXEXTRACT(A2:A11,"(.*)-")*1,"")<TIMEVALUE("10:00:00"),"Ear.Mor.",
IFERROR(REGEXEXTRACT(A2:A11,"(.*)-")*1,"")<TIMEVALUE("13:00:00"),"Lt.Mor.",
IFERROR(REGEXEXTRACT(A2:A11,"(.*)-")*1,"")<TIMEVALUE("16:00:00"),"Ear.Aft.",
IFERROR(REGEXEXTRACT(A2:A11,"(.*)-")*1,"")<TIMEVALUE("19:00:00"),"Lt.Aft.")))
OR
=ArrayFormula(IFERROR(IFS(
IFERROR(INDEX(SPLIT(A2:A11,"-"),0,1),"")<TIMEVALUE("10:00:00"),"Ear.Mor",
IFERROR(INDEX(SPLIT(A2:A11,"-"),0,1),"")<TIMEVALUE("13:00:00"),"Lt.Mor",
IFERROR(INDEX(SPLIT(A2:A11,"-"),0,1),"")<TIMEVALUE("16:00:00"),"Ear.Aft",
IFERROR(INDEX(SPLIT(A2:A11,"-"),0,1),"")<TIMEVALUE("19:00:00"),"Lt.Aft")))
(You can adjust ranges to your needs)
Functions used:
ArrayFormula
IFERROR
IFS
INDEX
TIMEVALUE
REGEXEXTRACT
SPLIT

Welcome to StackOverflow. Since I'm also the new member here like you, I would like to give you some advice and answer your question.
While asking a question there are some rules to follow:
you should give the important information about your question before putting your code
don't ask someone for a direct code. Try to handle it by yourself with doing a research about your question. Maybe there is already an answer to your question which can give you better idea than someone's answer in your post.
we all should understand that most of people here are busy with something. So we should respect their time and not ask already answered question or without having a code.
you can find more about how to ask a question here. I hope it'll help you to at least give an idea of what StackOverflow is.
For the answer to your question, I would suggest that to separate beginning time of appointment and end of it to different columns. Then you can write a formula using if statement like this: IF(AND(D2 > TIME(7,0,0), F2 < TIME(10,0,0)),"Early Morning"," another if statement ") Assume that D2 is beginning of appointment and F2 is the end. I might have made a mistake but overall idea is like that. Please refer to those links for more information about if statements and timeslots:
https://exceljet.net/excel-functions/excel-if-function
https://www.excelhow.net/how-to-compare-time-difference-with-certain-time-in-excel.html

Related

Trying to nest a transpose formula inside an array formula [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed yesterday.
Improve this question
Here's the sheet: https://docs.google.com/spreadsheets/d/1TbPKehggzCGWy6LyEuzHZc5RouBHhyju35bqIGpInhM/edit#gid=14120435
I know how to transpose the data in colA (=Transpose(A2:A)). I know how to write an array formula to output the data i'd like (F1), but I'd like to nest the Transpose formula into the formula in F1 so that as items are added to colA, the table on the right populates with the header rows relying on the values in A2:A and the data as it is in ColF
You could try:
=ARRAYFORMULA(LET(header,TOROW(A2:A,1),{header;IF(D2:D="",,E2:E*VLOOKUP(header,A:B,2,))}))
Or:
=ARRAYFORMULA(LET(header,TRANSPOSE(FILTER(A2:A,A2:A<>"")),{header;IF(D2:D="",,E2:E*VLOOKUP(header,A:B,2,))}))

google sheet vlookup a cell that do not contain multiple value [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
How can I list all the buyer names who has not buy Prodct "Phone" or Brand"Sony" or Seller" Ebay". Thank you so much for your help.
Assuming your "Date" header is in A1:
=FILTER(B2:B10, C2:C10<>"Phone", D2:D10<>"Sony", E2:E10<>"Ebay")
It's a simple FILTER.

ImportXML Google Sheets picking price from websites [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 days ago.
Improve this question
Formula gives error:
Imported content is empty.
for both URLs 1 & 2. I want Import Price of these products.
https://paytmmall.com/led-night-light-wireless-tap-touch-night-lamp-light-battery-powered-wardrobe-kitchen-cabinet-closet-push-stick-on-lamps-HOMLED-NIGHT-LIGLOB317966D12FA2A-pdp
https://www.amazon.in/Endless-EL-8201-Steel-Bike-Black/dp/B07MFY169J
=IMPORTXML("https://www.amazon.in/Endless-EL-8201-Steel-Bike-Black/dp/B07MFY169J","//span[#class='currencyINR']/text()")
for the 2nd URL, it's not doable the way you are trying. Amazon implemented anti-scraping measurements so the only way is to use their API:
For automated access to price change or offer listing change events
please refer to the MWS Subscription API:
https://developer.amazonservices.com/gp/mws/api.html/277-5993977-7749460?ie=UTF8&section=subscriptions&group=subscriptions&version=latest
=REGEXREPLACE(REGEXEXTRACT(QUERY(IMPORTXML(
"https://paytmmall.com/led-night-light-wireless-tap-touch-night-lamp-light-battery-powered-wardrobe-kitchen-cabinet-closet-push-stick-on-lamps-HOMLED-NIGHT-LIGLOB317966D12FA2A-pdp",
"//*"), "where Col1 contains'""price"":' limit 1"),
"price"":(.*)""a"), ",$", "")

How to properly boil multiple records down into one using ActiveRecord? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm learning Ruby and Rails while also trying to lose weight. To that end, I've made my first project a dieting app. Each time you eat something, you note its name, caloric value, and sugar, and then you can check a page showing your ongoing calorie deficit, a graph of your history, and so on.
The problem: Each meal has its own record, but I need to sum every meal from a given day up into a "Tuesday's total calories" value to use in a table. Before I duct-tape together some sloppy solution, I thought I'd ask what the proper way to do something like that is. Is there an ActiveRecord method I can use? If I write my own code to iterate over a month's worth of queries to build up 31 daily values, should I be doing that in my controller, or is there a way to do it in the model?
Iterating over all the meals would be bad, performance wise. Especially for people who do have many meals ;) It would load all the Meal records from the database, and then into memory.
ActiveRecord offers an interface to use the calculation functions provided by your database. It would only take a single query to let the database sum up the calories for a given day, week or month.
You'd do something to this end:
total_calories = Meal.where('DATE(created_at) = ?', Date.today).sum(:calories)
If you want to retrieve all the meals for the last 30 days with a single SQL query, you can do something like the code below. Notice how it still takes advantage of the sum method even with grouping:
Meal.where(created_at: 1.month.ago..Time.now)
.group('DATE(created_at)').order('date_created_at').sum(:calories)
Read about the calculation methods in the Rails documentation.
You can count and group by date in one query:
Meal.select('DATE(created_at) AS ordered_date, SUM(calories) AS calories').
group('DATE(created_at)').
order('ordered_date')
Perhaps you want to at a time range:
where(:created_at => (Time.now.beginning_of_month..Time.now))

VLOOKUP on continuous form [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
On K250 cell I've this put a formula so that when user submit data via form formula will work.
=VLOOKUP(F250,Available!$C$1:$E$72,3,false))
But problem is when someone submit a form, row K250 is getting down as K251 & submitted form taking palce K250. I've found some other guys are talking about using Array. I've tried this one but didn't work.
=arrayformula(VLOOKUP(F250,Available!$C$1:$E$72,3,false))
Whats the solution?
If i understood your problem correctly then do this:
Instead of giving a fixed range , use name ranges to avoid this problem.
To access name ranges you can use F3 key while typing vlookup.
Following are some screenshots to help you out.
It should work even your cells shift towards down, if the shifting is happening towards right then you might want to select the entire sheet to avoid confusion.
Hope this helps to solve your problem.
When a form submission is made in Google Sheets, a new row is inserted in the sheet receiving the form submissions, and yes, this will "push down" any formulae that were previously in that row.
And yes, one solution is to use an array formula. Something like this could be entered in row 1:
=ArrayFormula(IF(ROW(F:F)=1;"Column Header";IFERROR(VLOOKUP(F:F;Available!$C$1:$E$72;3*SIGN(ROW(F:F));0)))
Multivalue Parallel Lookup Solution
Note: if this answer is in the right ballpark, I will try and edit your question and tags accordingly.

Resources