I have the following records in my data base
fields: brand |model |attributes
----------------------------
record 1) apple |iPhone|6s space grey sprint
record 2) audi | a6 |quattro coupe
How can I store the attributes into different column names, with version/color/carrier columns for the first record and engine/type as the different columns for second record. The table should have 5 total columns for 1st record and 4 columns for the second record.
How do I achieve this? Should I split the table? If there are million products and each have varied length attributes then the number of columns in the table will be long. Whats the efficient way of doing this?
You can store the related attributes in a second table.
record|attribute|value
------+---------+-----
1 |version |6s
1 |color |space grey
1 |carrier |sprint
2 |engine |quattro
2 |type |coupe
This would allow for an item to have any number of (optional) attributes.
Related
I need a formula to sum a column of values. But I only want to sum the rows that have an ID that are unique among the entire range. See the example below where I have 6 rows, but there are only 3 unique IDs. My ideal outcome is a sum of 6 by adding one instance of UNIQUEID-00A, UNIQUEID-00B, and UNIQUEID-00C.
Notes:
A unique ID will always have the same value. For example, if UNIQUEID-00A were listed 1 or 100 times, the associated value will always be 1. So I don't need the formula to account for a scenario where the duplicate IDs have different values.
There may be instances where Column A (the ID) and Column B (the value) will not be sitting side-by-side. It might be that 2, 3, or more columns are in between the two columns.
The IDs and values could be 6 rows tall, or hundreds of rows tall. For that reason I'd like to use something like A2:A to target the IDs rather than having to specify a specific start and end point like A2:A7.
See the linked Google Sheet below for a copy of this.
ID
Value
UNIQUEID-00A
1
UNIQUEID-00B
2
UNIQUEID-00C
3
UNIQUEID-00A
1
UNIQUEID-00B
2
UNIQUEID-00C
3
https://docs.google.com/spreadsheets/d/1bU4J1RL5S0a_NvFjW_KVpiKi8603Tj9iVPeNzBlw-OA/edit?usp=sharing
Given the above table in A1:B7:
=sum(index(unique(A2:B7),,2))
UNIQUE returns the distinct rows of the range, INDEX (with column parameter = 2) to return only the value column, then SUM the result.
EDIT Based on the updated requirements, with the IDs in, for example, column A and the values to be summed in column C, use something like:
=sum(index(unique({A2:A,C2:C}),,2))
I'm assuming that there is no data below your input table. The UNIQUE here will return an extra blank row because of the unlimited range, but SUM will disregard it.
use:
=SUM(SORTN(B3:B, 9^9, 2, A3:A, 1))
sum B column
while returning all rows 9^9
that are unique 2
within A column
in whatever order 1
I have a database with hundreds (will be thousands) of entries related to utility assets. These assets are ranked and inspected on various conditions. There are multiple inspections done periodically and the old inspection data is accessible along side the new data. I would like to use conditional formatting to highlight a cell in column Q, based on duplicate rows in column G. For example: I have one asset with an ID of 1234 in column G with 3 different inspections, and thus three entries on different rows. I want to highlight column Q if that value (in column Q) is not the same among all three inspections in the various rows. Is this something that is possible? I have tried various combinations using the =IF, =COUNTIF(S) functions. The end goal here is to recognize that column Q is not equal on all three inspections so that it can be updated to be the same value.
In the example sheet the value in column Q on row 3 does not match row's 4, 5. The value in column Q on row 7 does not match row's 6, 8, and 9. The information in all Column besides G is subject to change, so it must be based off that value.
https://docs.google.com/spreadsheets/d/1xAvRaxMii3Xijbuw3ITKo0CBPhXkW9-Bgdg_LRxv1qA/edit?usp=sharing
Logically, if there are at least as many cells with the same ID but different Q value as there are with the same ID and the same Q value, then the current cell should be highlighted:
=countifs(G:G,G3,Q:Q,"<>"&Q3)>=countifs(G:G,G3,Q:Q,Q3)
I have two sheets, one with product names (sorted alphabetically) in column A, stock levels in column B.
Sheet 1
The other 2nd sheet with the same products in column A and stock levels in column B but populated by "importrange" but with columns C and D manually populated with customer names.
Sheet 2
What I'd like to do is, if a new product is introduced in the 1st sheet and it is positioned alphabetically in (let's say) row 3, then have a new row appear in the 2nd sheet.
Sheet 2 ideally
Currently, if a new product is introduced, the 2nd sheet will show the product and stock level, but the manually entered data in columns C and D will then be out of sync by one row.
Sheet 2 currently
Is there a way of automatically inserting a full row when the new product is imported to the 2nd sheet if I'm using "importrange"? If there is, can someone please help me here with the formula or code.
Basically what the OP is asking is how to keep the spatial/positional relation between two data sets. One alternative is to adopt the use of "keys" and "foreign keys".
Let says that a row represents a record.
A key is an unique value that used to identify a record.
A foreign key is a value added to a record to relate it with a record from another data set
Applying the above to the question case:
On Sheet 1 add a new column to hold the key for each row. When a new record is added the key of the other records should not be changed and a new key should be assigned to the new record.
Create a table of for the values of Sheet 2, columns C and D, and add to each record a key.
NOTE: This is the table were you should do the manual input.
Create a relation table having two columns one for the keys of the records on Sheet 1 and another for the records of Sheet 2, Columns C and D.
NOTE: I will not discuss here the arity of a relation concept as it will make the answer too long.
On Sheet 2, use IMPORTRANGE to get the values from Sheet 1, including the keys for each record.
Add a lookup formula (VLOOKUP / INDEX-MATCH) to get the related records from the table created on step 2 by using the relation table created on step 3.
Related
Synchronize independent spreadsheet rows, filled by IMPORTRANGE()
Associating row data with importrange data in a new workbook on Google Sheets
I have 2 columns of account numbers. The first column has far more numbers than the second column. I need to know if the numbers in column 1 show up anywhere in column two.
Try
=VLOOKUP(A1,B:B,1,0)
in a third column, copied down to all rows populated in ColumnA.
I'm trying to make a budget sheet for a trip.
I have 2 sheets in a Google Spreadsheet. One contains the steps of the trip. The other contains a dashboard with the sum for each of these 5 groups of steps: "food", "activities", "shopping", "hotels" and "vehicle".
My first sheet is like that (with 4 columns - the 3rd is the price):
1. Go to museum 45 Activity
2. Playing cards 5 Activity
3. Sleeping at Bohaha Hotel 123 Hotel
4. Take breakfast 10 Food
In the other sheet, I want to make different sums conditioned by the value of the 4th column, and using the values of the 3rd column.
The result of the second sheet in this example would be:
Food 10
Activities 50
Shopping 0
Hotels 123
Vehicle 0
How can I do that?
I can use a function if necessary.
Simple SUMIFS:
=SUMIFS(Sheet1!C1:C99, Sheet1!D1:D99, A1)
Assuming description in second sheet matches description in 4th column (the formula is not going to do the stemming for you to convert Activity to Activities - you can use 1 column for exact match string and 1 column as reporting label...)
I found the perfect formula :)
=SUM(FILTER('Sheet 1'!H5:H; 'Sheet 1'!G5:G="Food"))