#130 — Use Formulas to Handle Interval Association

Problem description & analysis:

Here below is a data table:

Task: We want to calculate the price value in column B according to the quantity in column A, and the calculation should follow the rule: different quantity intervals corresp…


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing

Problem description & analysis:

Here below is a data table:

source table

Task: We want to calculate the price value in column B according to the quantity in column A, and the calculation should follow the rule: different quantity intervals correspond to different prices, as shown in the table below:

calculation rule

Solution:

Use SPL XLL and enter in cell B2:

=spl("=[15,13.75,13,12.5]([30,50,100,300,500].pseg@r(?1))",A2)

The result is as follows:

result one

Then drag B2 down to every relevant row:

final results

The idea of the calculation is to use the pseg function to calculate which interval the quantity value belongs to [30, 50, 100, 300, 500], and then take out the price of the corresponding interval from the price sequence [15, 13.75, 13, 12.5] and return.

Download esProc Desktop for FREE and revolutionize your Excel processes using SPL XLL!! 🚀✨⬇️

✨SPL download address: esProc Desktop FREE Download

✨Plugin Installation Method: SPL XLL Installation and Configuration

✨References to other rich Excel operation cases: Desktop and Excel Data Processing Cases

✨YouTube FREE courses: SPL Programming


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing


Print Share Comment Cite Upload Translate Updates
APA

Judith-Excel-Sharing | Sciencx (2025-01-13T02:24:20+00:00) #130 — Use Formulas to Handle Interval Association. Retrieved from https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/

MLA
" » #130 — Use Formulas to Handle Interval Association." Judith-Excel-Sharing | Sciencx - Monday January 13, 2025, https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/
HARVARD
Judith-Excel-Sharing | Sciencx Monday January 13, 2025 » #130 — Use Formulas to Handle Interval Association., viewed ,<https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/>
VANCOUVER
Judith-Excel-Sharing | Sciencx - » #130 — Use Formulas to Handle Interval Association. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/
CHICAGO
" » #130 — Use Formulas to Handle Interval Association." Judith-Excel-Sharing | Sciencx - Accessed . https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/
IEEE
" » #130 — Use Formulas to Handle Interval Association." Judith-Excel-Sharing | Sciencx [Online]. Available: https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/. [Accessed: ]
rf:citation
» #130 — Use Formulas to Handle Interval Association | Judith-Excel-Sharing | Sciencx | https://www.scien.cx/2025/01/13/130-use-formulas-to-handle-interval-association/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.