I am trying to rank the data in one column in my google sheet so that there are no duplicate rankings. I've seen some solutions such as =RANK(A2,$A$2:$A$10)+COUNTIF($A$2:A2,A2)-1, but the problem is that it increments the duplicates based on occurrence in the sheet.
Let's say my data that I'd like ranked is as follows:
1
1
1
2
The rank order would be 2, 3, 4, 1. The problem is, if I change the second entry to 2 (so that my data is now 1, 2, 1, 2) the ranking order becomes 3, 1, 4, 2 instead of 3, 2, 4, 1 like I want. In the original data, the fourth entry was initially the highest and I'd like it to still have the higher rank, but since the formula counts occurrences it gets demoted. Any way to accomplish this?
No, not with native spreadsheet functions. Spreadsheet formulae have no "awareness" of which values were entered most recently.
You would need to resort to Google Apps Script run on an "on edit" trigger.
Related
I am using Google Forms to create a survey with weighted answers. I've been able to make things work when there is just one possible correct answer - I made a separate tab with a set of answer tables with point values assigned, then used vlookup to call back and match the given response to the answer table and fetch the assigned point value.
=VLOOKUP(P2, Sheet2!$A$49:$B$50, 2, FALSE)
P2 is a value pulled from the "Form Responses" tab - in this case, a yes/no answer. Sheet 2 has a table for each question with the possible answers and the point values for each answer (A49=yes, A50=no)
However, for some of the questions, multiple answers are valid and I want to add up the total number of points for that given question. So for example:
What are your hobbies? and folks can choose from
Riding your bike
Playing football
Swimming
Going fishing
Painting
And the respective point values are 2, 2, 3, 4, 4
So then, if someone chose the "Swimming" and "Going fishing" checkboxes in the form, I'd get "7", and if someone chose "Riding your bike", "Playing football", and "Painting", I'd get "8".
I realize that the output from the Google form will list the chosen answers all in one cell (Playing football, Going fishing), so I'm not sure how to make it count each answer (especially since some of them are multi-word answers) and output the sum of the values.
VLOOKUP is not suitable in this case. try FILTER like:
=FILTER(Sheet2!B49:B50, Sheet2!A49:A50=P2)
then VLOOKUP it like:
=SUMPRODUCT(IFNA(VLOOKUP(FILTER(Sheet2!B49:B50, Sheet2!A49:A50=P2), sheetx!A:B, 2, 0)))
where sheetx!A:B is like:
Riding your bike
2
Playing football
2
Swimming
3
Going fishing
4
Painting
4
and if Sheet2!B49:B50 contains multiple comma+space separated values you will need to split them like:
=SUMPRODUCT(IFNA(VLOOKUP(FILTER(
IFERROR(SPLIT(Sheet2!B49:B50, ", ")), Sheet2!A49:A50=P2), sheetx!A:B, 2, 0)))
I have a Google sheet - table 1 below and all the data is given. Table 1 data is people(VenderNo) claim that they want to join event with what data(EventStartDate) and what booth number(BoothNo). So the data is duplicated because people update it with new line and never allowd to delete or update the existing record(table 1).
Input data
And I also have a Google sheet - table 2 below and only EventStartDate and BoothNo are given. All I want to do is the result like table 2's VenderNo. The purpose of table 2 is trying to summarize which vendor is eventually joining the event with latest booth number.
Ideal result like blow:
Output data
May I know how to write this formula in table 2 column C (VendorNo) with autofill function like ={ "VendorNo"; unique(General!A2:A) } without hand dragging the formula?
Any thoughts and thank you.
P.S.: I am sorry I couldn't post image above directly because I don't have enough reputation.
Revision 1 for Mike Result: (Yellow highlight mismatched, since v001 should not join the same event date with 2 booths)
Revision 2 for Mike Result: (Yellow highlight mismatched, since v004 added to 2022-11-11 for BoothNo A01. BoothNo C01 doesn't erase as expected, Because same vendor(VendorNo) should only be with same date( EventStartDate) & latest booth selection(BoothNo))
Try
={"vendor";arrayformula(if(
iferror(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A,C2:C},3,0))
=
iferror(vlookup(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A},2,0)&"~"&E2:E,({unique({A2:A&"~"&B2:B}),(vlookup(unique({A2:A&"~"&B2:B}),SORT({A2:A&"~"&B2:B,C2:C,row(A2:A)},3,0),2,0))}),2,0),""),
iferror(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A},2,0)),""
))}
You don't need a Formula for that. Just select your columns and go to "Data" ->"Sort data"->"advanced sort settings" and then sort by column "EventStartDate" and secondly add sort by another column and add "BoothNo".
In the end you can run a data clean up to remove duplicates. You find it also under data.
to get the latest update from your table 1 you can use:
=SORTN(SORT(A2:C, B2:B, 0), 9^9, 2, 1, 1)
for your table 2 try:
={"VN"; INDEX(IFNA(VLOOKUP(E2:E&F2:F,
SORTN(SORT({B2:B&C2:C, A2:C}, B2:B, 0), 9^9, 2, 2, 1), 2, 0)))}
I have a database of customers, where his zone, seller and some other values can change, and I want to generate a table of the last occurrence of each one
Heres a demo sheet
using Vlookup doesn't get the last occurrence
My database is very big and I need something to not slow my sheet that much, because I was using a formula like this one for each cell
=ARRAYFORMULA(LOOKUP(2,1/(C2:C=A2),$D$2:$D))
but the sheet is very slow because of this
Any help on this please ?
use:
=ARRAY_CONSTRAIN(SORTN(SORT({C3:E, B3:B}, 4, 0), 9^9, 2, 1, 1), 9^9, 3)
I'm looking to list and count unique values from multiple cells. The practical application is to list and count the scenes in a movie that a particular character appears in.
I'm using the following array formula to list the scenes from the data table:
=ArrayFormula(TEXTJOIN(", ",TRUE,IF($B$11:$B$64=E13,$A$11:$A$64,"")))
It will returns something like this (these are the scene numbers):
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4
But I want it to return:
2,3,4
Then to count the unique values I used the following formula:
COUNTUNIQUE(SPLIT(F13,", ",0))
But the problem here is that it returns "1" even when the array formula correctly returns no value (i.e. the character didn't appear in any scene)
Here is the Google Sheet so you can see things in context:
https://docs.google.com/spreadsheets/d/1dwrORFJ508duRP1no7258dqLemujkOjpvA3XmolqtsU/edit?usp=sharing
Any help will be greatly appreciated!
F11:
=ARRAYFORMULA(TEXTJOIN(",",1,UNIQUE(IF(E11=B$11:B,A$11:A,))))
=COUNT(SPLIT(F11,","))
Use UNIQUE() to find unique values before joining them
SPLIT parameter 1 can't be empty, which gives a #VALUE error,Which is counted as 1 with COUNTUNIQUE.Use IFERROR to mask it.(Since we already have unique values, COUNT is simpler)
I need to do a combo options with condtional sub options in google spreadsheet. Here is an example of what I need to do.
If the option choosen in column A was "Option 1" then options available in column B must be 1, 2, 3 and 4 and If option 2 was choosen in column A then options 5, 6, 7 and 8 must be available in in the B cell of the same row.
Can you help me?
I set up an example sheet to show one solution:
https://docs.google.com/spreadsheets/d/1yquke1pCponpEHjgZWCa7t8RyiWCAr1QR6VnYwJNSVw/edit?usp=sharing
Unfortunately the data validation in each row of Col B has to be adjusted manually so that the row number matches with Sheet2 though. For this reason it would be a pain to set up for a large number of rows.
I believe secondary validation can also be done by a script though so it may be worth searching one of those out