Google Sheets中的复杂公式使用许多引用

huangapple go评论61阅读模式
英文:

Google Sheets complex formula using many references

问题

I understand that you want a translation of the provided text, excluding the code portion. Here is the translation of the non-code part:

我有一个导出表格,其中包含所有产品的详细信息,如价格、特价等。

我已经格式化了某些单元格,以创建简单的表格,以便其他人更容易填写或调整价格。然后,这些表格用于更新导出表格的价格,但有许多条件来尽量自动化这个过程。

因此,目标是如果更新了格式化/简化的表格中的价格,就从那里获取价格。这已经完美运行了,但现在应该考虑在特定商店的产品上,将价格四舍五入为.95或.49。为此,它应该首先查找增值税(VAT)并重新计算不包括VAT的价格,然后按上述方式四舍五入,然后重新计算价格以获取四舍五入价格的不包括VAT的价格。

到目前为止,我已经有以下公式:

=IF($G2="drankuwelnlview",IF(ISNA(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE)),VALUE(Importdata!C2),IF(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE)="BTW 21%",VALUE(Importdata!C2)*1.21,IF(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE)="BTW 9%",VALUE(Importdata!C2)*1.09,
VALUE(Importdata!C2)))),VALUE(Importdata!C2))

在这种情况下,它应该首先检查产品是否适用于G列中的'drankuwelnlview'商店。如果是这样,它应该获取列A中的SKU值,并在'HG Productenlijst'选项卡中搜索相同的SKU(也在列A中),并获取列J中的值,其中包含增值税信息,如:'BTW 21%'、'BTW 9%'或'BTW 0%'。

它应该提取百分比,然后将增值税乘以或加到数字/价格上,然后四舍五入到.95或.49。之后,它应该再次除以或去除增值税,以便价格恢复为不包括增值税的价格。

'HG Productenlijst'选项卡是增值税信息的来源,而'Importdata'是一个已经格式化的表格,包含更新后的产品价格和详细信息。

此外,以下是'HG Productenlijst'表格的示例:
Google Sheets中的复杂公式使用许多引用

这是'Importdata'表格的示例:
Google Sheets中的复杂公式使用许多引用

'Copy of Importdata'是我们希望在确定增值税后更新价格以使其四舍五入的表格。

英文:

I have an export sheet where I get all products with a couple of details like price, special price etc.

I have formatted certain cells to create simple tables for someone to fill in or adjust the prices more easily. Then, those tables are used to update the prices in a 'copy' of the export, but with many conditions to automate it as much as possible.

So the goal is to have the prices being taken from the formatted/simple sheet if updated. This is already working perfectly, but now it should consider rounding the prices to .95 or .49 when it is a product on a specific shop. To do so, it should first look up the VAT and recalculate the ex. VAT price to include VAT, then round it as stated above, then recalculate the price to get the ex. VAT for the rounded price.

This is what I got so far:

=IF($G2="drankuwelnlview",IF(ISNA(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE)),VALUE(Importdata!C2),IF(VLOOKUP($A2,'HG Productenlijst’!A2:J,10,FALSE)="BTW 21%”,VALUE(Importdata!C2)*1.21,IF(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE)="BTW 9%”,VALUE(Importdata!C2)*1.09,
VALUE(Importdata!C2)))),VALUE(Importdata!C2))

In this case, it should first check to see if the product is for the 'drankuwelnlview' store in column G. If so, it should take the SKU value in column A and search in the 'HG Productenlijst' tab for the same SKU (also in column A) and get the value in column J, which is a string containing the VAT like: 'BTW 21%', 'BTW 9%' or 'BTW 0%'.

It should extract the percentage and multiply or add the VAT to the number/price and then round up to either .95 or .49. After that, it should divide or remove the VAT again so the price is back to ex. VAT.

The tab 'HG Productenlijst' is where the VAT is, and 'Importdata' is an already formatted table with the updated product prices and details.

In addition, here is an example of the table in 'HG Productenlijst':
Google Sheets中的复杂公式使用许多引用

Here is an example of the table in 'Importdata':
Google Sheets中的复杂公式使用许多引用

The 'Copy of Importdata' is the sheet where we want to update the prices to be nicely rounded after determining the VAT for the calculation.

答案1

得分: 2

我不确定我是否完全理解你对四舍五入的意思,但可以尝试使用以下公式。它使用LET函数来执行步骤并创建相应的变量名称。如果有用的话,请告诉我!

=IF($G2="drankuwelnlview",
LET(vat,IFNA(VALUE(REGEXEXTRACT(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE),"\d+"))/100,0),
vatpr,VALUE(Importdata!C2)(1+vat),
upvalue,IF(ISBETWEEN(MOD(vatpr
100,100),0,50),ROUNDUP(vatpr)-0.51,ROUNDUP(vatpr)-0.05),
upvalue/(1+vat)),
VALUE(Importdata!C2))

它使用REGEXEXTRACT函数来查找增值税(这样你就不需要很多IF语句),然后计算含增值税的价格。它将价格四舍五入,并查找小数点后的数字是否在0到50之间,如果是,则将其四舍五入为0.95或0.49。最后,返回该值除以(1+vat)。

英文:

I don't know if I fully understood what you pretended with the roundings, but try with this formula. It uses LET to make steps and create variables to those names. Try it and let me know if it's useful!

=IF($G2="drankuwelnlview",
LET(vat,IFNA(VALUE(REGEXEXTRACT(VLOOKUP($A2,'HG Productenlijst'!A2:J,10,FALSE),"\d+"))/100,0),
vatpr,VALUE(Importdata!C2)*(1+vat),
upvalue,IF(ISBETWEEN(MOD(vatpr*100,100),0,50,0,0),ROUNDUP(vatpr)-0.51,ROUNDUP(vatpr)-0.05),
upvalue/(1+vat)),
VALUE(Importdata!C2))

It finds the VAT with REGEXEXTRACT (so you don't need many IF statements), and then calculates the price with the VAT. Rounds it up and finds if the remaining numbers after the comma are between 0 and 50 so it then rounds it to .95 or .49. And finally returns that value divided (1+vat)

huangapple
  • 本文由 发表于 2023年4月13日 18:46:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76004519.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定